在内核升级后,Linux上不了网
##在上一篇blog里面解决了上网【内网】问题,后期发现仍然访问不了外网。
###首先查看网卡版本,系统安装的是8195显卡,然而电脑适配的是8168显卡,首先安装了8168网卡,重启电脑,仍然上不了网。
###在网上搜索教程,基本上就是配置网络参数,网络重启的操作。
ping 内网网关是可以的
ping www.baidu.com 不通
ping 8.8.8.8 不通
首先:
sudo vi /etc/resolv.conf
在里面添加:
nameserver 8.8.8.8
然后打开:
sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto enp3s0
iface enp3s0 inet static
address 114.212.225.177
netmask 255.255.252.0
gateway 114.212.224.1
#自动获得IP地址
#
auto enp3s0
iface enp3s0 inet dhcp
写完之后,重启一下
sudo /etc/init.d/networking restart
就这这步,报错了
Restarting network (via systemctl): Job for network.service failed because the control process exit
提示命令:systemctl status networking.service查看
networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/networking.service.d
└─50-insserv.conf-$network.conf
Active: failed (Result: exit-code) since 四 2019-08-29 15:42:17 CST; 1min 15s ago
Docs: man:interfaces(5)
Process: 13333 ExecStop=/sbin/ifdown -a --read-environment --exclude=lo (code=exited, status=0/SUCCES
Process: 13498 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 13494 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-
Main PID: 13498 (code=exited, status=1/FAILURE)
: Starting Raise network interfaces...
: RTNETLINK answers: File exists
: Failed to bring up enp3s0.
: networking.service: Main process exited, code=exited, status=1/FAILUR
: Failed to start Raise network interfaces.
: networking.service: Unit entered failed state.
: networking.service: Failed with result 'exit-code'.
能看出来是网卡不对应。
直接命令:
ip addr flush dev enp3s0 && /etc/init.d/networking restart
ip addr flush dev ens33单独命令会断开远程连接
enp3s0是网卡名,根据自己的网卡更改名字。
参考的几个大佬的链接会附在下面: