Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

There's more...

If you want to see our routed traffic that's hitting centos2, log onto your second VM and make sure that tcpdump is installed:

$ sudo yum install -y tcpdump

Next, ensure that your extra route from the before is in place on centos1, and start a ping going to any address in the range:

$ ping 172.16.0.3
PING 172.16.0.3 (172.16.0.3) 56(84) bytes of data.

Back on centos2, start tcpdump against our eth1 interface:

$ sudo tcpdump -i eth1

You should start to see ICMP echo requests from centos1, without a response:

12:48:26.735055 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 1, length 64
12:48:27.736195 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 2, length 64
12:48:28.738030 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 3, length 64
12:48:29.743270 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 4, length 64
12:48:30.747098 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 5, length 64
12:48:31.750916 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 6, length 64
12:48:32.752634 IP 192.168.33.10 > 172.16.0.3: ICMP echo request, id 1696, seq 7, length 64

Back on centos1, stop your ping (Ctrl C) and note the packets transmitted and packets lost:

--- 172.16.0.3 ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7019ms

Because we had nowhere for centos2 to route our packet to, and centos2 isn't actually set up as a router, the packets simply went unanswered, and centos1 remained friendless—poor centos1.