20-高級路由:OSPF -特殊區域 GRE
二、命令部署:
1、R1和R3部署隧道:分別給R1、R3上隧道配地址、設置Tunnel的源地址、目的地址、模式、靜態路由
R3(config)#interface tunnel 3
R3(config-if)#ip add 31.1.1.3 255.255.255.0
R3(config-if)#tunnel source 3.3.3.3 可以是環回口地址:
R3(config-if)#tunnel destination 1.1.1.1
R3(config-if)#tunnel mode gre ip
R3#show run int tunnel 3 //查看tunnel的配置
R3#ping 1.1.1.1 source 3.3.3.3 //tunnel的源目地址是否可以ping通
R3(config)#ip route 1.1.1.1 255.255.255.255 13.1.1.1
同理:R1部署Tunnel
R1(config)#interface tunnel 1
R1(config-if)#ip add 31.1.1.1 255.255.255.0
R1(config-if)#tunnel source 1.1.1.1
R1(config-if)#tunnel destination 3.3.3.3
R1(config-if)#tunnel mode gre ip
R1(config)#ip route 3.3.3.3 255.255.255.255 13.1.1.3
2、將Tunnel網段地址到Area 0
R3(config-router)#network 31.1.1.0 0.0.0.255 area 0
R1(config)#router ospf 110
R1(config-router)#network 31.1.1.0 0.0.0.255 area 0
三、驗證:
1、配置驗證:
①查看Tunnel配置
R3#show run int tunnel 3
interface Tunnel3
ip address 31.1.1.3 255.255.255.0
tunnel source 3.3.3.3
tunnel destination 1.1.1.1
②Tunnel的源目是否可以Ping通
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
③部署靜態路由到1.1.1.1,因為不允許將Tunnel的IP地址和源目同時宣告進OSPF,否則將會是Tunnel一會起來,一會掛掉。
R3#show ip route
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 [1/0] via 13.1.1.1
2、部署完成後,查看R5否有對方路由條目:
R5#show ip route ospf
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/11114] via 35.1.1.3, 00:00:34, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/11115] via 35.1.1.3, 00:00:34, FastEthernet0/0
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/11114] via 35.1.1.3, 00:00:34, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/11113] via 35.1.1.3, 00:00:34, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/2] via 35.1.1.3, 00:05:20, FastEthernet0/0
31.0.0.0/24 is subnetted, 1 subnets
O IA 31.1.1.0 [110/11112] via 35.1.1.3, 00:05:20, FastEthernet0/0
R2#show ip route ospf
35.0.0.0/24 is subnetted, 1 subnets
O IA 35.1.1.0 [110/11113] via 12.1.1.1, 00:02:26, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 24.1.1.4, 00:39:03, FastEthernet1/0
5.0.0.0/32 is subnetted, 1 subnets
O IA 5.5.5.5 [110/11114] via 12.1.1.1, 00:02:26, FastEthernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/2] via 12.1.1.1, 00:02:26, FastEthernet0/0
31.0.0.0/24 is subnetted, 1 subnets
O 31.1.1.0 [110/11112] via 12.1.1.1, 00:02:26, FastEthernet0/0
R5#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:
!!!!!
20-高級路由:OSPF -特殊區域 GRE