Fedora禁止NetworkManager,使用原network服务

首先说明一下为什么我们选择使用network,而不是NetworkManager进行网络管理。公司产品是自己的云计算平台,在网络管理部分使用的是openvswitch,NetworkManager可以使用nm-openvswitch进行间接管理ovs,但是其中有很多无法设置的部分,并且管理ovs初始化及后续功能使用scripts是相对容易的,另外对原network的管理模式比较清楚,故综合以上我们选择舍弃NetworkManager的优势,而选择更传统的network进行管理。

在fedora中其实更改起来比较简单,先说一下整体要点:

  1. 安装传统network管理包network-scripts-teamd
  2. 设置network为随系统启动
  3. 设置NetworkManager不随系统启动
  4. 重启服务器即可

 

1 安装network-scripts-teamd

# dnf install network-scripts-teamd

2 设置network为随系统启动

# systemctl enable network

3 设置NetworkManager不随系统启动

# systemctl disable NetworkManager

4 重启服务器

# reboot

5 验证

[root@localhost ~]# systemctl status network
 network.service - LSB: Bring up/down networking
     Loaded: loaded (/etc/rc.d/init.d/network; generated)
     Active: active (exited) since Wed 2020-07-08 11:52:02 EDT; 7h left
       Docs: man:systemd-sysv-generator(8)
    Process: 669 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
        CPU: 438ms
7月 08 11:51:58 localhost.localdomain network[669]: [46B blob data]
7月 08 11:52:02 localhost.localdomain NET[950]: /etc/sysconfig/network-scripts/ifup-post : updated /etc/resolv.conf
7月 08 11:52:02 localhost.localdomain network[669]: [42B blob data]
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/all/rp_filter (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/default/rp_filter (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/all/accept_source_route (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/default/accept_source_route (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/all/promote_secondaries (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd-sysctl[967]: Not setting net/ipv4/conf/default/promote_secondaries (explicit setting exists).
7月 08 11:52:02 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
[root@localhost ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:NetworkManager(8)

完成

PS:

如果需要增加openvswitch支持,需要安装openvswitch和network-scripts-openvswitch

# dnf install openvswitch network-scripts-openvswitch

 

About the author

liuyuhang

View all posts

发表评论