如何在 Ubuntu 中设置 3 个网卡并让它们被 ping 通?

如何在 Ubuntu 中设置 3 个网卡并让它们被 ping 通?

我在 Ubuntu 中设置了一个带有 3 个网卡的 Virtual Box。如何配置这 3 个网卡,以便能够成功 ping 63 到 189 和 192 之间的网络?

以下是我的设置细节:

ifconfig -a: 

eth0      Link encap:Ethernet  HWaddr 08:00:27:81:63:b9  
          inet addr:10.0.10.63  Bcast:10.0.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe81:63b9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:92867 errors:0 dropped:1871 overruns:0 frame:0
          TX packets:1240 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10881093 (10.8 MB)  TX bytes:137882 (137.8 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:5f:24:13  
          inet addr:10.0.10.192  Bcast:10.0.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe5f:2413/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:86057 errors:0 dropped:10 overruns:0 frame:0
          TX packets:134 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9619445 (9.6 MB)  TX bytes:15193 (15.1 KB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:a2:ec:03  
          inet addr:10.0.10.189  Bcast:10.0.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea2:ec03/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:85404 errors:0 dropped:2 overruns:0 frame:0
          TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9534726 (9.5 MB)  TX bytes:10143 (10.1 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:58 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5592 (5.5 KB)  TX bytes:5592 (5.5 KB)


route: 
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.10.1       0.0.0.0         UG    0      0        0 eth1
10.0.10.0       *               255.255.255.0   U     0      0        0 eth0
10.0.10.0       *               255.255.255.0   U     1      0        0 eth2
10.0.10.0       *               255.255.255.0   U     1      0        0 eth1
link-local      *               255.255.0.0     U     1000   0        0 eth0


ping: 
bert@bert-VirtualBox:~/git/southwest_mw/lib/policy/src/main/java/com/istuary/policy$ ping 10.0.10.63
PING 10.0.10.63 (10.0.10.63) 56(84) bytes of data.
64 bytes from 10.0.10.63: icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from 10.0.10.63: icmp_seq=2 ttl=64 time=0.058 ms
^C
--- 10.0.10.63 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.042/0.050/0.058/0.008 ms
bert@bert-VirtualBox:~/git/southwest_mw/lib/policy/src/main/java/com/istuary/policy$ ping 10.0.10.189
PING 10.0.10.189 (10.0.10.189) 56(84) bytes of data.
64 bytes from 10.0.10.189: icmp_seq=1 ttl=64 time=0.053 ms
64 bytes from 10.0.10.189: icmp_seq=2 ttl=64 time=0.054 ms
^C
--- 10.0.10.189 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.053/0.053/0.054/0.007 ms
bert@bert-VirtualBox:~/git/southwest_mw/lib/policy/src/main/java/com/istuary/policy$ ping 10.0.10.192
PING 10.0.10.192 (10.0.10.192) 56(84) bytes of data.
64 bytes from 10.0.10.192: icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from 10.0.10.192: icmp_seq=2 ttl=64 time=0.161 ms
^C
--- 10.0.10.192 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.026/0.093/0.161/0.068 ms
bert@bert-VirtualBox:~/git/southwest_mw/lib/policy/src/main/java/com/istuary/policy$ ping -I eth0 10.0.10.192
PING 10.0.10.192 (10.0.10.192) from 10.0.10.63 eth0: 56(84) bytes of data.
From 10.0.10.63 icmp_seq=1 Destination Host Unreachable
From 10.0.10.63 icmp_seq=2 Destination Host Unreachable
From 10.0.10.63 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.10.192 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3009ms
pipe 3
bert@bert-VirtualBox:~/git/southwest_mw/lib/policy/src/main/java/com/istuary/policy$ ping -I eth0 10.0.10.189
PING 10.0.10.189 (10.0.10.189) from 10.0.10.63 eth0: 56(84) bytes of data.
From 10.0.10.63 icmp_seq=1 Destination Host Unreachable
From 10.0.10.63 icmp_seq=2 Destination Host Unreachable
From 10.0.10.63 icmp_seq=3 Destination Host Unreachable
^C
--- 10.0.10.189 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3011ms
pipe 3

相关内容