1.带下一跳的静态路由:
-----------------------------R1----------------------------------
R1(config)#ip route 23.1.1.0 255.255.255.0 12.1.1.2
R1(config)#ip route 3.3.3.0 255.255.255.0 12.1.1.2
R1(config)#ip route 2.2.2.0 255.255.255.0 12.1.1.2
R1#show ip route static
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [1/0] via 12.1.1.2
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 12.1.1.2
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 12.1.1.2
-------------------------R2-----------------------------------------------------
R2(config)#ip route 3.3.3.0 255.255.255.0 23.1.1.3
R2(config)#ip route 1.1.1.0 255.255.255.0 12.1.1.1
R2#show ip route static
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 [1/0] via 12.1.1.1
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 23.1.1.3
---------------------------R3-----------------------------------------------------
R3(config)#ip route 12.1.1.0 255.255.255.0 23.1.1.2
R3(config)#ip route 2.2.2.0 255.255.255.0 23.1.1.2
R3(config)#ip route 1.1.1.0 255.255.255.0 23.1.1.2
----------------------------------------------------------------------------------------
验证实验的结果:
R1#ping 23.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/40/40 ms
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/40/40 ms
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/20/20 ms
R2#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/20/20 ms
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/18/20 ms
R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/40/40 ms
R3#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/18/20 ms
R3#ping 12.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/42/50 ms
*实现三个路由器全线连通。
=====================================================
2.汇总路由的实现:
------------------------------R2----------------------------------------------------
R2#show ip route
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 [1/0] via 12.1.1.1
2.0.0.0/24 is subnetted, 3 subnets
C 2.2.1.0 is directly connected, Loopback1
C 2.2.2.0 is directly connected, Loopback0
C 2.2.3.0 is directly connected, Loopback2
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 23.1.1.3
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
*加配了两个loopback地址。
-----------------------------------R1--------------------------------------------------
R1(config)#no ip route 2.2.2.0 255.255.255.0 12.1.1.2
R1(config)#ip route 2.2.0.0 255.255.252.0 12.1.1.2
R1#show ip route static
2.0.0.0/22 is subnetted, 1 subnets
S 2.2.0.0 [1/0] via 12.1.1.2
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 12.1.1.2
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 12.1.1.2
------------------------R3---------------------------------------------------------------
R3(config)#no ip route 2.2.2.0 255.255.255.0 23.1.1.2
R3(config)#ip route 2.2.0.0 255.255.252.0 23.1.1.2
R3#show ip rout static
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 [1/0] via 23.1.1.2
2.0.0.0/22 is subnetted, 1 subnets
S 2.2.0.0 [1/0] via 23.1.1.2
12.0.0.0/24 is subnetted, 1 subnets
S 12.1.1.0 [1/0] via 23.1.1.
-----------------------------------------------------------------------------------------
实验结果的验证:
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/20/20 ms
R1#ping 2.2.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/22/30 ms
R3#ping 2.2.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/18/20 ms
R3#ping 2.2.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 10/18/20 ms
================================================================
3.浮动静态路由的配置:
R1(config)#ip route 2.2.0.0 255.255.252.0 10.1.1.2
R1#show ip route static
2.0.0.0/22 is subnetted, 1 subnets
S 2.2.0.0 [1/0] via 12.1.1.2
[1/0] via 10.1.1.2
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 12.1.1.2
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 12.1.1.2
R1#traceroute 2.2.2.2
Type escape sequence to abort.
Tracing the route to 2.2.2.2
1 10.1.1.2 20 msec 20 msec 20 msec
R1(config)#ip route 2.2.0.0 255.255.252.0 10.1.1.2 100 //修改静态路由的管理距离值,默认情况下是1.(小则优,大则劣)
R1#show ip route static
2.0.0.0/22 is subnetted, 1 subnets
S 2.2.0.0 [1/0] via 12.1.1.2
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 12.1.1.2
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 12.1.1.2
R1(config)#int s1/0
R1(config-if)#shut
R1#show ip route static
2.0.0.0/22 is subnetted, 1 subnets
S 2.2.0.0 [100/0] via 10.1.1.2
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
4.带送出接口的静态路由:
------------------R1-----------------------------------------------------------------------------
R1(config)#ip route 2.2.2.0 255.255.255.0 f1/0
R1(config)#ip route 23.1.1.0 255.255.255.0 f1/0
R1(config)#ip route 3.3.3.0 255.255.255.0 f1/0
R1(config)#ip route 23.1.1.0 255.255.255.0 s0/0
R1(config)#ip route 3.3.3.0 255.255.255.0 s0/0
----------------------------R2-------------------------------------------------------------------
R2(config)#ip route 1.1.1.0 255.255.255.0 f1/0
R2(config)#ip route 3.3.3.0 255.255.255.0 f2/0
--------------------------R3---------------------------------------------------------------------
R3(config)#no ip route 12.1.1.0 255.255.255.0 f0/0
R3(config)#ip route 10.1.1.0 255.255.255.0 f0/0
R3(config)#ip route 1.1.1.0 255.255.255.0 f0/0
R3(config)#ip route 2.2.2.0 255.255.255.0 f0/0
实验的验证:
1)带以太网标识的静态路由是需要代理arp的功能的:
R1#debug arp
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
*Mar 1 00:30:24.839: IP ARP: creating incomplete entry for IP address: 3.3.3.3 interface FastEthernet1/0
*Mar 1 00:30:24.839: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0
*Mar 1 00:30:24.911: IP ARP: rcvd rep src 3.3.3.3 cc01.07a0.0010, dst 10.1.1.1 FastEthernet1/0.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 72/103/148 ms
*R1学习到的mac地址是R2的mac地址:
R2#show int f1/0 //可以接口port的mac地址。
FastEthernet1/0 is up, line protocol is up
Hardware is AmdFE, address is cc01.07a0.0010 (bia cc01.07a0.0010)
当我们关闭R2的代理功能以后,看R1是否可以ping通3.3.3.3:
R2(config)#int f1/0
R2(config-if)#no ip proxy-arp //注意关闭代理arp的功能是在接口模式下的。
下面我们用R1来ping3.3.3.3:
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
*Mar 1 00:47:13.019: IP ARP: creating incomplete entry for IP address: 3.3.3.3 interface FastEthernet1/0
*Mar 1 00:47:13.019: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0.
*Mar 1 00:47:15.019: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0.
*Mar 1 00:47:17.019: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0.
*Mar 1 00:47:19.019: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0.
*Mar 1 00:47:21.019: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0.
Success rate is 0 percent (0/5)
*关闭了R2的代理功能以后,无法连通了。
2)串口是不需要代理功能的:
R1#traceroute 3.3.3.3
Type escape sequence to abort.
Tracing the route to 3.3.3.3
1 12.1.1.2 80 msec 64 msec 32 msec
2 23.1.1.3 92 msec * 108 msec
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/86/120 ms
*串口本身就没有mac地址,而且是点对点的链路,故不需要代理mac的功能。
3)当s0/0和f1/0同时开启的时候就是负载均衡:
R1#traceroute 3.3.3.3
Type escape sequence to abort.
Tracing the route to 3.3.3.3
1 12.1.1.2 44 msec
*Mar 1 01:07:51.411: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0
*Mar 1 01:07:51.467: IP ARP rep filtered src 3.3.3.3 cc01.07a0.0010, dst 10.1.1.1 cc00.07a0.0010 wrong cable, interface FastEthernet1/0 * 56 msec
2 23.1.1.3 132 msec *
*Mar 1 01:07:57.595: IP ARP: sent req src 10.1.1.1 cc00.07a0.0010,
dst 3.3.3.3 0000.0000.0000 FastEthernet1/0
*Mar 1 01:07:57.687: IP ARP rep filtered src 3.3.3.3 cc01.07a0.0010, dst 10.1.1.1 cc00.07a0.0010 wrong cable, interface FastEthernet1/0 *
*走哪条路是路由器转发的性能决定的。