2、实验过程
r1(config)#int f0/0
r1(config-if)#ip add 10.1.1.1 255.255.0.0
r1(config-if)#no shut
r1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/16 is subnetted, 1 subnets
C 10.1.0.0 is directly connected, FastEthernet0/0
r2(config)#int f0/0
r2(config-if)#ip add 10.1.1.2 255.255.255.0
r2(config-if)#no shut
r2(config)#ip route 10.1.2.0 255.255.255.0 f0/0
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S
10.1.2.0 is directly connected, FastEthernet0/0//这是由于有代理ARP的缘故,导致的直连。
C 10.1.1.0 is directly connected, FastEthernet0/0
测试R1连通性
r1#ping 10.1.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/93/180 ms
查看R3的接口f0/0和R4 的接口f0/1
r3#sh int f0/0
FastEthernet0/0 is up, line protocol is up
Hardware is i82543 (Livengood), address is ca02.0ff4.0008 (bia ca02.0ff4.0008)
Internet address is 10.1.1.3/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:43, output 00:00:08, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
211 packets input, 47528 bytes
Received 111 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog
0 input packets with dribble condition detected
421 packets output, 43303 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
r4#sh int f0/1
FastEthernet0/1 is up, line protocol is up
Hardware is i82543 (Livengood), address is ca03.0ff4.0006 (bia ca03.0ff4.0006)
Internet address is 10.1.2.4/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:09, output 00:00:08, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
133 packets input, 13652 bytes
Received 16 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog
0 input packets with dribble condition detected
136 packets output, 14190 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
r1#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.1.1 - ca00.0cc4.0008 ARPA FastEthernet0/0
Internet 10.1.2.4 0 ca02.0ff4.0008 ARPA FastEthernet0/0
r1#
注:这里的R4的MAC地址与实际查到的不符合,和查的R3的f0/0的mac地址相同,这个也说明了代理ARP的功能。R3会代理R4回应R1,他就是R4,最后保证了R1和R4正常通信。
r2#ping 10.1.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.4, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 44/79/116 ms
调试在R3上关闭代理ARP功能看一下效果
r3(config)#int f0/0
r3(config-if)#no ip proxy-arp
r3#sh ip int f0/0
FastEthernet0/0 is up, line protocol is up
Internet address is 10.1.1.3/24
Broadcast address is 255.255.255.255
Address determined by setup command
MTU is 1500 bytes
Helper address is not set
Directed broadcast forwarding is disabled
Outgoing access list is not set
Inbound access list is not set
Proxy ARP is disabled
Local Proxy ARP is disabled
Security level is default
Split horizon is enabled
ICMP redirects are always sent
ICMP unreachables are always sent
ICMP mask replies are never sent
IP fast switching is enabled
IP fast switching on the same interface is disabled
IP Flow switching is disabled
IP CEF switching is enabled
IP Fast switching turbo vector
IP Normal CEF switching turbo vector
IP multicast fast switching is enabled
IP multicast distributed fast switching is disabled
IP route-cache flags are Fast, CEF
Router Discovery is disabled
IP output packet accounting is disabled
IP access violation accounting is disabled
TCP/IP header compression is disabled
RTP/IP header compression is disabled
Policy routing is disabled
Network address translation is disabled
BGP Policy Mapping is disabled
WCCP Redirect outbound is disabled
WCCP Redirect inbound is disabled
WCCP Redirect exclude is disabled
再测试R1的连通性
r1#clear arp-cache //清楚r1的arp缓存
r1#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.1.3 0 ca02.0ff4.0008 ARPA FastEthernet0/0
Internet 10.1.1.1 - ca00.0cc4.0008 ARPA FastEthernet0/0
r1#ping 10.1.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5
r1#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.1.3 1 ca02.0ff4.0008 ARPA FastEthernet0/0
Internet 10.1.1.1 - ca00.0cc4.0008 ARPA FastEthernet0/0
Internet 10.1.2.4 0 Incomplete ARPA
在R2上测试
r2#clear ip route *
r2#clear arp-cache
r2#sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.1.1.2 - ca01.0cc4.0008 ARPA FastEthernet0/0
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S 10.1.2.0 is directly connected, FastEthernet0/0
C 10.1.1.0 is directly connected, FastEthernet0/0
r2#ping 10.1.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
注:由于R3关闭了代理ARP功能,而R2还以为是直连,就导致了不同现象。
修改R2的静态路由看一下
r2(config)#no ip route 10.1.2.0 255.255.255.0 f0/0
r2(config)#ip route 10.1.2.0 255.255.255.0 10.1.1.3
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
S
10.1.2.0 [1/0] via 10.1.1.3
C 10.1.1.0 is directly connected, FastEthernet0/0
r2#ping 10.1.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.4, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 52/93/152 ms