LINUX安装好后无法访问网络

LINUX安装好后无法访问网络

在虚拟机安装好新的LINUX系统后,ping www.baidu.com ,发现无法ping通。

键入ifconfig查询配置:

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

  ether 00:0c:29:3e:ad:2d txqueuelen 1000 (Ethernet)

  RX packets 0 bytes 0 (0.0 B)

  RX errors 0 dropped 0 overruns 0 frame 0

  TX packets 0 bytes 0 (0.0 B)

  TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

  inet 127.0.0.1 netmask 255.0.0.0

   inet6 ::1 prefixlen 128 scopeid 0x10<host>

   loop txqueuelen 0 (Local Loopback)

   RX packets 942 bytes 79580 (77.7 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 942 bytes 79580 (77.7 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

得到本机的网卡是eno16777728

然后,重启网卡服务:service network restart

再次查询:ifconfig,发现依旧如上所示,并且无法访问网络。

修改网卡配置: root模式下vim /etc/sysconfig/network-scripts/ifcfg-eno16777728(最后的数字不一定一致,不要照搬,根据查询出来的配置信息灵活替换),然后将文件里最后一项的ONBOOT=no在插入模式中修改为yes并保存退出,以后计算机自动启动网卡。

现在手动启动网卡服务ifup eno16777736

重新键入ifconfig:

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

  inet 192.168.81.134 netmask 255.255.255.0 broadcast 192.168.81.255

   inet6 fe80::20c:29ff:fe3e:ad2d prefixlen 64 scopeid 0x20<link>

   ether 00:0c:29:3e:ad:2d txqueuelen 1000 (Ethernet)

   RX packets 125 bytes 14963 (14.6 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 147 bytes 15265 (14.9 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

   inet 127.0.0.1 netmask 255.0.0.0

   inet6 ::1 prefixlen 128 scopeid 0x10<host>

   loop txqueuelen 0 (Local Loopback)

   RX packets 946 bytes 80000 (78.1 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 946 bytes 80000 (78.1 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

问题解决,网卡服务成功启动,并且后续不需要每次都手动启动网卡服务

本文参照:http://114193107.blog.51cto.com/3025337/1676433

上一篇:mybatis sql中if判断传入Integer类型,传入0时,判断没有执行


下一篇:泛型委托及委托中所涉及到匿名方法、Lambda表达式