实训内容:使用相关技术将SW1交换机模拟为internet交换机,实现SW1模拟internet路由表和SW1内部业务路由表隔离,internet路由表位于VPN实例名称internet内。
设备 | Loopback 1 | Loopback 1 | Loopback 1 |
SW1 | Loopback 1 | 1.1.1.1/32 | |
E1/0/1 | Vlan 10 | 192.168.10.1/24 | |
E1/0/2 | Vlan 20 | 172.16.1.1/24 | |
E1/0/18模拟internet | Valn 4091 | 202.11.1.1/30 | |
E1/0/19模拟internet | Vlan 4092 | 222.11.1.1/30 | |
SW2 | Loopback 1 | 2.2.2.2/32 | |
E1/0/1 | Vlan 10 | 192.168.10.2/24 | |
E1/0/24 | Vlan 4090 | 222.11.1.2/30 | |
R1 | Loopback 0 | 3.3.3.3/32 | |
G0/0 | 172.16.1.2/24 | ||
G0/1 | 202.11.1.2/30 |
一、基础配置:
SW1配置:
SW1#conf
SW1(config)#int l
SW1(config-if-loopback1)#ip add 1.1.1.1 255.255.255.255
SW1(config)#vlan 10;20
SW1(config)#vlan 4092;4091
SW1(config)#int vlan 10
SW1(config-if-vlan10)#ip add 192.168.10.1 255.255.255.252
SW1(config-if-vlan10)#int vlan 20
SW1(config-if-vlan20)#ip add 172.16.1.1 255.255.255.252
SW1(config-if-vlan20)# int l1
SW1(config-if-loopback1)#ip add 1.1.1.1 255.255.255.255
SW1(config-if-loopback1)#int e1/0/1
SW1(config-if-ethernet1/0/1)#sw acc vlan 10
Set the port Ethernet1/0/1 access vlan 10 successfully
SW1(config-if-ethernet1/0/1)#
SW1(config-if-ethernet1/0/1)#int e1/0/2
SW1(config-if-ethernet1/0/2)#sw acc vlan 20
Set the port Ethernet1/0/2 access vlan 20 successfully
SW1(config-if-ethernet1/0/2)#int e1/0/18
SW1(config-if-ethernet1/0/18)#sw acc vlan 4091
Set the port Ethernet1/0/18 access vlan 4091 successfully
SW1(config-if-ethernet1/0/18)#int e1/0/19
SW1(config-if-ethernet1/0/19)#sw acc vlan 4092
Set the port Ethernet1/0/19 access vlan 4092 successfully
SW1(config-if-ethernet1/0/2)#exit
SW1(config)#
SW1(config)#ip vrf internet
SW1(config)#int vlan 4091
SW1(config-if-vlan4091)#ip vrf forwarding internet
SW1(config-if-vlan4091)#ip add 202.11.1.1 255.255.255.252
SW1(config-if-vlan4091)#exi
SW1(config)#int vlan 4092
SW1(config-if-vlan4092)#ip vrf forwarding internet
SW1(config-if-vlan4092)#ip add 222.11.1.1 255.255.255.252
SW1(config-if-vlan4092)#exi
SW1(config)#exi
SW1#wr
SW2配置:
SW2#con
SW2(config)#vlan 10;4090
SW2(config)#int vlan 10
SW2(config-if-vlan10)#
SW2(config-if-vlan10)#ip add 192.168.10.2 255.255.255.252
SW2(config-if-vlan10)#int vlan 4090
SW2(config-if-vlan4090)#ip add 222.11.1.2 255.255.255.252
SW2(config-if-vlan4090)#int l1
SW2(config-if-loopback1)#ip add 2.2.2.2 255.255.255.255
SW2(config-if-loopback1)#int e1/0/1
SW2(config-if-ethernet1/0/1)#sw acc vlan 10
Set the port Ethernet1/0/1 access vlan 10 successfully
SW2(config-if-ethernet1/0/1)#
SW2(config-if-ethernet1/0/1)# int e1/0/24
SW2(config-if-ethernet1/0/24)#sw acc vlan 4090
Set the port Ethernet1/0/24 access vlan 4090 successfully
SW2#wr
R1配置:
Router>ena
Router_config#hostname r1
r1_config#INT G0/0
r1_config_g0/0#ip add 172.16.1.2 255.255.255.252
r1_config_g0/0#no sh
r1_config_g0/0#int g0/1
r1_config_g0/1#ip add 202.11.1.2 255.255.255.252
r1_config_g0/1#no sh
r1_config_g0/1#int l0
r1_config_l0#ip add 3.3.3.3 255.255.255.255
r1_config_l0#no sh
r1_config_l0#exit
r1 #wr
二、路由配置:
SW1配置:
SW1#conf
SW1(config)#router ospf 1
SW1(config-router)#router-id 1.1.1.1
SW1(config-router)#network 192.168.10.0 0.0.0.3 ar 0
SW1(config-router)#network 172.16.1.0 0.0.0.3 ar 0
SW1(config-router)#network 1.1.1.1 0.0.0.0 ar 0
SW1(config-router)#exit
SW1(config)#ip route vrf internet 0.0.0.0 0.0.0.0 202.11.1.2
SW1(config)#ip route vrf internet 0.0.0.0 0.0.0.0 222.11.1.2
SW1(config)#exit
SW1#wr
SW2配置:
SW2#conf
SW2(config)#router ospf 1
SW2(config-router)#router-id 2.2.2.2
SW2(config-router)#network 192.168.10.0 0.0.0.3 ar 0
SW2(config-router)#network 2.2.2.2 0.0.0.0 ar 0
SW2(config-router)#default-information originate
SW2(config-router)#exit
SW2(config)#ip route 0.0.0.0 0.0.0.0 222.11.1.1
SW2(config)#exit
SW2#wr
R1配置:
r1#conf
r1_config#router ospf 1
r1_config_ospf_1#router-id 3.3.3.3
r1_config_ospf_1#network 172.16.1.0 255.255.255.252 ar 0
r1_config_ospf_1#network 3.3.3.3 255.255.255.255 ar 0
r1_config_ospf_1#default-information originate
r1_config_ospf_1#exi
r1_config#ip route 0.0.0.0 0.0.0.0 202.11.1.1
r1_config#exi
r1#wr
三、显示路由信息:
SW1路由信息:
SW1#show ip rou
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is 192.168.10.2 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/10] via 192.168.10.2, Vlan10, 00:02:28 tag:0
C 1.1.1.1/32 is directly connected, Loopback1 tag:0
O 2.2.2.2/32 [110/2] via 192.168.10.2, Vlan10, 00:14:39 tag:0
O 3.3.3.3/32 [110/2] via 172.16.1.2, Vlan20, 00:16:29 tag:0
C 127.0.0.0/8 is directly connected, Loopback tag:0
C 172.16.1.0/30 is directly connected, Vlan20 tag:0
C 192.168.10.0/30 is directly connected, Vlan10 tag:0
Total routes are : 7 item(s)
SW2路由信息:
SW2(config)#show ip rou
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is not set
S* 0.0.0.0/0 [1/0] via 222.11.1.1, Vlan4090 tag:0
O 1.1.1.1/32 [110/2] via 192.168.10.1, Vlan10, 00:22:47 tag:0
C 2.2.2.2/32 is directly connected, Loopback1 tag:0
O 3.3.3.3/32 [110/3] via 192.168.10.1, Vlan10, 00:23:39 tag:0
C 127.0.0.0/8 is directly connected, Loopback tag:0
O 172.16.1.0/30 [110/2] via 192.168.10.1, Vlan10, 00:25:46 tag:0
C 192.168.10.0/30 is directly connected, Vlan10 tag:0
C 222.11.1.0/30 is directly connected, Vlan4090 tag:0
Total routes are : 8 item(s)
SW2(config)#
R1路由信息:
r1_config#show ip rou
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2, L - Local
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - ISIS inter-level, I - IPSEC type
VRF ID: 0
S 0.0.0.0/0 [1,0] via 202.11.1.1(on GigaEthernet0/1)
O 1.1.1.1/32 [110,2] via 172.16.1.1(on GigaEthernet0/0)
O 2.2.2.2/32 [110,3] via 172.16.1.1(on GigaEthernet0/0)
C 3.3.3.3/32 is directly connected, Loopback0
C 172.16.1.0/30 is directly connected, GigaEthernet0/0
O 192.168.10.0/30 [110,2] via 172.16.1.1(on GigaEthernet0/0)
C 202.11.1.0/30 is directly connected, GigaEthernet0/1
五、验证:
SW1#ping vrf internet 1.1.1.1
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 33/39/50 ms
SW1#ping vrf internet 2.2.2.2
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/9/33 ms
SW1#ping vrf internet 3.3.3.3
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/9/16 ms
SW1#ping vrf internet 202.11.1.2
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 202.11.1.2, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/3/16 ms
SW1#ping vrf internet 222.11.1.2
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 222.11.1.2, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
SW2#ping 202.11.1.1
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 202.11.1.1, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/3/16 ms
SW2#
SW2#ping 202.11.1.2
Type ^c to abort.
Sending 5 56-byte ICMP Echos to 202.11.1.2, timeout is 2 seconds.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r1_config#
r1_config#ping 222.11.1.1
PING 222.11.1.1 (222.11.1.1): 56 data bytes
!!!!!
--- 222.11.1.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 1/3/12 ms
r1_config#ping 222.11.1.2
PING 222.11.1.2 (222.11.1.2): 56 data bytes
!!!!!
--- 222.11.1.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 1/1/1 ms