标签:str 令行 修改 以太网 连接 rri restart 恢复 pack
问题:连上网线后,有ip,但是无法访问外网。
我的解决方案是:
1.通过命令行ifconfig命令查看以太网(即网线插口)的名称,如下图,‘enp3s0‘是网线插口(Ethernet以太网): zhuml@zhuml-Latitude-3350:~$ ifconfig enp3s0 Link encap:Ethernet HWaddr 14:18:77:a5:24:3d inet addr:10.58.101.247 Bcast:10.58.103.255 Mask:255.255.252.0 inet6 addr: fe80::2883:9232:3f1e:fe3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:13212 errors:0 dropped:0 overruns:0 frame:0 TX packets:1696 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3760852 (3.7 MB) TX bytes:238743 (238.7 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:558 errors:0 dropped:0 overruns:0 frame:0 TX packets:558 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:72352 (72.3 KB) TX bytes:72352 (72.3 KB) wlp4s0 Link encap:Ethernet HWaddr a4:02:b9:0a:76:b1 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 2.命令行添加或修改网络参数 zhuml@zhuml-Latitude-3350:~$ sudo gedit /etc/network/interfaces 弹出一个文本窗,如下: # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback 在里面添加以太网的相关信息 # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto esp3s0 iface esp3s0 inet dhcp 3.重启网络 zhuml@zhuml-Latitude-3350:~$ sudo /etc/init.d/networking restart 现在应该能够恢复插上网线,能够上网;
标签:str 令行 修改 以太网 连接 rri restart 恢复 pack
原文地址:https://www.cnblogs.com/jiu0821/p/8824462.html