理解谁干的,有可能是nm干的,或者黑客干的,极有可能是CentOS8引入两个管理网络的network和NetworkManager都启动后“打架”干的。
实际上这俩都开了:
systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; generated)
Active: active (exited) since Sat 2022-03-26 05:56:48 CST; 9min ago
#systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-03-26 05:56:41 CST; 9min ago
Docs: man:NetworkManager(8)
Main PID: 2465 (NetworkManager)
只开network的步骤:
一、都禁用:
systemctl mask network
Created symlink /etc/systemd/system/network.service → /dev/null.
systemctl mask NetworkManager
Created symlink /etc/systemd/system/NetworkManager.service → /dev/null.
二、启用一个:
/usr/lib/systemd/systemd-sysv-install enable network
#下面提示怎么启用:
systemctl enable network
network.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable network
三、测试NetworkManager 被彻底禁用了:
systemctl start NetworkManager
Failed to start NetworkManager.service: Unit NetworkManager.service is masked.
mask彻底禁用systemctl服务:
https://blog.csdn.net/stpice/article/details/104569146/
----------------------------------------------------------
cd /etc/sysconfig/network-scripts/ifcfg-lanbr0
#cat ifcfg-
ifcfg-eno1 ifcfg-lanbr0 ifcfg-lo
在桥接的网卡lanbr0新增:
/etc/sysconfig/network-scripts/
DNS1=202.106.196.115
DNS2=114.114.114.114
重启动后,会将/etc/resolv.conf的配置重新刷成上面的(测试过删除一行:nameserver 114.114.114.114,重启后会自动加上):
#cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.106.196.115
nameserver 114.114.114.114
#cat ifcfg-eno1
DEVICE="eno1"
ONBOOT="yes"
BRIDGE="lanbr0"
#cat ifcfg-lanbr0
DEVICE="lanbr0"
ONBOOT="yes"
TYPE="Bridge"
BOOTPROTO="none"
IPADDR="10.10.0.1**"
NETMASK="255.255.255.0"
GATEWAY="10.10.0.1"
DNS1=202.106.196.115
DNS2=114.114.114.114
Centos重新启动网络配置文件,/etc/resolv.conf被覆盖或清空问题解决
实际上这俩都开了:
systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; generated)
Active: active (exited) since Sat 2022-03-26 05:56:48 CST; 9min ago
#systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-03-26 05:56:41 CST; 9min ago
Docs: man:NetworkManager(8)
Main PID: 2465 (NetworkManager)
只开network的步骤:
一、都禁用:
systemctl mask network
Created symlink /etc/systemd/system/network.service → /dev/null.
systemctl mask NetworkManager
Created symlink /etc/systemd/system/NetworkManager.service → /dev/null.
二、启用一个:
/usr/lib/systemd/systemd-sysv-install enable network
#下面提示怎么启用:
systemctl enable network
network.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable network
三、测试NetworkManager 被彻底禁用了:
systemctl start NetworkManager
Failed to start NetworkManager.service: Unit NetworkManager.service is masked.
mask彻底禁用systemctl服务:
https://blog.csdn.net/stpice/article/details/104569146/
----------------------------------------------------------
cd /etc/sysconfig/network-scripts/ifcfg-lanbr0
#cat ifcfg-
ifcfg-eno1 ifcfg-lanbr0 ifcfg-lo
在桥接的网卡lanbr0新增:
/etc/sysconfig/network-scripts/
DNS1=202.106.196.115
DNS2=114.114.114.114
重启动后,会将/etc/resolv.conf的配置重新刷成上面的(测试过删除一行:nameserver 114.114.114.114,重启后会自动加上):
#cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.106.196.115
nameserver 114.114.114.114
#cat ifcfg-eno1
DEVICE="eno1"
ONBOOT="yes"
BRIDGE="lanbr0"
#cat ifcfg-lanbr0
DEVICE="lanbr0"
ONBOOT="yes"
TYPE="Bridge"
BOOTPROTO="none"
IPADDR="10.10.0.1**"
NETMASK="255.255.255.0"
GATEWAY="10.10.0.1"
DNS1=202.106.196.115
DNS2=114.114.114.114
Centos重新启动网络配置文件,/etc/resolv.conf被覆盖或清空问题解决
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/11267/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2022-3-26 06:56
评论列表