![无法通过以太网电缆连接两台机器](https://linux22.com/image/1570843/%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%E4%BB%A5%E5%A4%AA%E7%BD%91%E7%94%B5%E7%BC%86%E8%BF%9E%E6%8E%A5%E4%B8%A4%E5%8F%B0%E6%9C%BA%E5%99%A8.png)
我有两台 Ubuntu 机器,通过以太网电缆连接,机器 A 的接口为 eth0,机器 B 的接口为 eth6。我在两台机器上都配置了 IP。
机器 A 上的 ifconfig -a(仅显示 eth0):
eth0 Link encap:Ethernet HWaddr 98:90:96:9b:83:f1
inet addr:100.0.2.1 Bcast:100.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::9a90:96ff:fe9b:83f1/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:372 errors:0 dropped:0 overruns:0 frame:0
TX packets:280 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:101005 (101.0 KB) TX bytes:30148 (30.1 KB)
Interrupt:20 Memory:f7c00000-f7c20000
机器A上的route -n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 203.135.63.1 0.0.0.0 UG 0 0 0 eth3
100.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth3
203.135.63.0 0.0.0.0 255.255.255.192 U 1 0 0 eth3
机器 B 上的 ifconfig -a(仅显示 eth6)
eth6 Link encap:Ethernet HWaddr ec:08:6b:0b:85:72
inet addr:100.0.2.3 Bcast:100.0.2.225 Mask:255.255.255.0
inet6 addr: fe80::ee08:6bff:fe0b:8572/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:90 (90.0 B)
在机器B上路由-n:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.102.72.1 0.0.0.0 UG 0 0 0 eth7
10.102.72.0 0.0.0.0 255.255.254.0 U 1 0 0 eth7
100.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0
100.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth6
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
当我从机器 B ping 100.0.2.1 时,我得到了以下信息:
PING 100.0.2.1 (100.0.2.1) 56(84) bytes of data.
From 100.0.2.3 icmp_seq=1 Destination Host Unreachable
From 100.0.2.3 icmp_seq=2 Destination Host Unreachable
From 100.0.2.3 icmp_seq=3 Destination Host Unreachable
From 100.0.2.3 icmp_seq=4 Destination Host Unreachable
From 100.0.2.3 icmp_seq=5 Destination Host Unreachable
From 100.0.2.3 icmp_seq=6 Destination Host Unreachable
From 100.0.2.3 icmp_seq=7 Destination Host Unreachable
From 100.0.2.3 icmp_seq=8 Destination Host Unreachable
From 100.0.2.3 icmp_seq=9 Destination Host Unreachable
^C
--- 100.0.2.1 ping statistics ---
11 packets transmitted, 0 received, +9 errors, 100% packet loss, time 10054ms
pipe 3
请让我知道我做错了什么。