前期帮用户架设了一台虚拟机,相关网络配置正常后,用户安装好所有应用程序 ,重启后突然发现网络不能正常连接,但开机前几秒钟可正常,后续持续故障,
service network restart 后能正常几秒钟故障依旧。
(1)linux下关闭安全狗 (问题没有解决)
使用:
service safedog status
service safedog start
service safedog stop
查看、启动或停止服务,问题依然没有解决。
(2)重新配置网络设置 (问题没有解决)
Centos 网络设置
这里首先是进入/etc/sysconfig/network-scripts中查看现有的配置文件:
cd /etc/sysconfig/network-scripts
通过ls查看文件看到该文件目录下的文件:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=ae05ccde-6a29-4332-b486-f3042da73ac0
DEVICE=eno16777736
ONBOOT=no
这里说一下需要修改的位置:
#修改
BOOTPROTO=static #这里讲dhcp换成ststic
ONBOOT=yes #将no换成yes
#新增
IPADDR=192.168.85.100 #静态IP
GATEWAY=192.168.85.2 #默认网关
NETMASK=255.255.255.0 #子网掩码
保存退出后,重启网络服务:
service network restart
Restarting network (via systemctl): [ 确定 ]
查看当前ip:
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:e7:b8:77 brd ff:ff:ff:ff:ff:ff
inet 192.168.85.100/24 brd 192.168.85.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fee7:b877/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 52:54:00:b9:8f:6c brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
link/ether 52:54:00:b9:8f:6c brd ff:ff:ff:ff:ff:ff
(3)解决办法 :关闭NetworkManager服务 正常。
运行下列命令:
chkconfig network off
chkconfig network on
service NetworkManager stop (注意大小写)
service NetworkManager start (注意大小写)
这命令的意思是:重新运行网络管理装置
转载于:https://blog.51cto.com/onroad/2377077