我在 Linux 中遇到了一个奇怪的问题,在 VMWare 上的 SLES12 下运行。通过发出 service docker start 启动 docker 后,我从 putty 中失去了与 Linux 机器的网络连接……为了恢复它,我必须从另一台 Linux 机器 ssh 到它。所以看起来它把我的接口弄乱了
启动docker之前
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:B6:33:30
inet addr:10.100.0.101 Bcast:10.100.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb6:3330/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:163546 errors:0 dropped:10 overruns:0 frame:0
TX packets:70909 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18524059 (17.6 Mb) TX bytes:15505464 (14.7 Mb)
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:16094 errors:0 dropped:0 overruns:0 frame:0
TX packets:16094 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1425313 (1.3 Mb) TX bytes:1425313 (1.3 Mb)
之后ifconfig
$ ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:D6:7A:25:1C
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:d6ff:fe7a:251c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:318 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26040 (25.4 Kb) TX bytes:1394 (1.3 Kb)
docker_gw Link encap:Ethernet HWaddr 02:42:01:39:74:46
inet addr:172.18.0.1 Bcast:172.18.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:1ff:fe39:7446/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:5206 (5.0 Kb)
eth0 Link encap:Ethernet HWaddr 00:50:56:B6:33:30
inet addr:10.100.0.101 Bcast:10.100.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:feb6:3330/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164222 errors:0 dropped:10 overruns:0 frame:0
TX packets:71533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18582001 (17.7 Mb) TX bytes:15580880 (14.8 Mb)
答案1
这是由于错误的路由 ip 或冲突的 mac 地址造成的
你可以使用 #ip a 和 #ip r 命令查看发生了什么
如果你需要更多帮助,请在此处发送你的 IP 或导出
你可以通过 /sbin/route add default gw [Youtip] 更改默认网关来修复你的网络