linux centos 7 網卡突然不能上網異常解決
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
這裏說一下需要修改的位置:
#修改
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
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 (註意大小寫)
這命令的意思是:重新運行網絡管理裝置
linux centos 7 網卡突然不能上網異常解決