出现这种情况该如何处理
network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network on
CentOS/RHEL
的网络配置文件默认目录为/etc/sysconfig/network-scripts
默认第一块物理网卡配置文件为ifcfg-eth0
, 如果有第二块物理网卡, 配置文件则为ifcfg-eth1
以此类推。 注意
: 如果新增物理网卡没有配置文件,可选择复制系统默认的进行修改。
设置NetworkManger开机不启动, 同时停止NetworkManger服务
[root@wenhs-aws ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@wenhs-aws ~]# systemctl disable NetworkManager
[root@wenhs-aws ~]# systemctl stop NetworkManager
添加一块物理网卡, 然后新增网络连接配置文件
复制配置eth0配置文件为eth1
[root@wenhs-aws ~]# cp /etc/sysconfig/network-scripts/{ifcfg-eth0,ifcfg-eth1}
[root@wenhs-aws ~]# ls /etc/sysconfig/network-scripts/
ifcfg-eth0 ifup-bnep
ifcfg-eth1 ifup-eth
ifcfg-lo ifup-ippp
ifdown ifup-ipv6
ifdown-bnep ifup-isdn
ifdown-eth ifup-plip
ifdown-ippp ifup-plusb
ifdown-ipv6 ifup-post
ifdown-isdn ifup-ppp
ifdown-post ifup-routes
ifdown-ppp ifup-sit
ifdown-routes ifup-Team
ifdown-sit ifup-TeamPort
ifdown-Team ifup-tunnel
ifdown-TeamPort ifup-wireless
ifdown-tunnel init.ipv6-global
ifup network-functions
ifup-aliases network-functions-ipv6
[root@wenhs-aws ~]#
编辑网卡配置文件
[root@wenhs-aws ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.0.100.100
NETMASK=255.255.255.0
GATEWAY=10.0.100.1
DNS1=10.0.100.1
重启network网络服务加载网络并设置开机启动
[root@wenhs-aws ~]# systemctl restart network
[root@wenhs-aws ~]# systemctl enable network