预配置

各路由器上的配置 R1(config)#int lo0 R1(config-if)#ip add 1.1.1.1 255.255.255.0 R1(config-if)#int s2/1 R1(config-if)#ip add 192.168.0.1 255.255.255.0 R1(config-if)#no sh

R2(config)#int s2/1 R2(config-if)#ip add 192.168.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s2/2 R2(config-if)#ip add 172.16.0.2 255.255.255.0 R2(config-if)#no sh

R3(config)#int s2/1 R3(config-if)#ip add 172.16.0.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#int lo0 R3(config-if)#ip add 3.3.3.3 255.255.255.0

实验过程 第一步:配置各路由器使用协议 R1(config)#router ei 11 R1(config-router)#no au R1(config-router)#net 192.168.0.0

R2(config)#router ei 11 R2(config-router)#no au R2(config-router)#net 192.168.0.0 R2(config-router)#net 172.16.0.0

R3(config)#router ei 11 R3(config-router)#net 172.16.0.0 R3(config-router)#no au

第二步:检查R1、R3是否学习到路由 R1#sh ip rout ………… 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 172.16.0.0/24 is subnetted, 1 subnets D 172.16.0.0 [90/2681856] via 192.168.0.2, 00:01:06, Serial2/1 C 192.168.0.0/24 is directly connected, Serial2/1

R3#sh ip rout ………… 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 172.16.0.0/24 is subnetted, 1 subnets C 172.16.0.0 is directly connected, Serial2/1 D 192.168.0.0/24 [90/2681856] via 172.16.0.2, 00:01:07, Serial2/1

第三步:在R1、R3上创建GRE隧道 R1(config)#int tunnel 0 R1(config-if)#tunnel source s2/1 //这里的源地址可以为接口,也可以为此接口的ip地址。 R1(config-if)#tunnel destination 172.16.0.3 //这里的目标,只能写ip地址。 R1(config-if)#ip add 10.0.0.1 255.255.255.0

R3(config)#int tunnel 0 R3(config-if)#tunnel source s2/1 R3(config-if)#tunnel destination 192.168.0.1 R3(config-if)#ip add 10.0.0.3 255.255.255.0

第四步:在R1上ping R3的10.0.0.3 接口进行测试 R1#debug ip pack detail IP packet debugging is on (detailed) R1#ping 10.0.0.3

Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/93/140 ms R1# *Jan 6 22:10:06.315: IP: s=192.168.0.2 (Serial2/1), d=224.0.0.10, len 60, rcvd 2, proto=88 *Jan 6 22:10:06.667: IP: tableid=0, s=10.0.0.1 (local), d=10.0.0.3 (Tunnel0), routed via FIB *Jan 6 22:10:06.671: IP: s=10.0.0.1 (local), d=10.0.0.3 (Tunnel0), len 100, sending *Jan 6 22:10:06.675: ICMP type=8, code=0 *Jan 6 22:10:06.675: IP: s=192.168.0.1 (Tunnel0), d=172.16.0.3 (Serial2/1), len 124, sending, proto=47

第五步:配置eigrp as 22 通过tunnel 0 建立邻接关系 R3(config)#router ei 22 R3(config-router)#net 10.0.0.0 //运行路由协议的目的为,可以使它们的流量能通过隧道。 R1(config)#router ei 22 R1(config-router)#net 10.0.0.0

第六步:在R1上查看eigrp邻接关系 R1#sh ip ei nei 22 IP-EIGRP neighbors for process 22 H Address Interface Hold Uptime SRTT RTO Q Seq (sec) (ms) Cnt Num 0 10.0.0.3 Tu0 12 00:00:54 1 4500 0 1 //通过tunnel 0 已经与R3建立了邻接关系