实验拓扑
配置命令
R1:
[R1]int LoopBack 0
[R1-LoopBack0]ip add 192.168.0.1 30
[R1-LoopBack0]q
[R1]int LoopBack 1
[R1-LoopBack1]ip add 192.168.0.5 30
[R1-LoopBack1]q
[R1]int LoopBack 2
[R1-LoopBack2]ip add 192.168.0.9 30
[R1-LoopBack2]q
[R1]int gi 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.0.18 28
[R1-GigabitEthernet0/0/1]int gi 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.0.98 28
[R1]ip route-static 192.168.0.32 28 192.168.0.17
[R1]ip route-static 192.168.0.80 28 192.168.0.97
[R1]ip route-static 192.168.0.48 28 192.168.0.17
[R1]ip route-static 192.168.0.64 28 192.168.0.97
[R1]ip route-static 192.168.0.112 28 192.168.0.97
[R1]ip route-static 192.168.0.128 28 192.168.0.97
[R1]ip route-static 192.168.0.0 28 NULL 0
[R1]ip route-static 0.0.0.0 0 192.168.0.17
[R1]ip route-static 0.0.0.0 0 192.168.0.97
R2:
[R2]int gi 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.0.17 28
[R2-GigabitEthernet0/0/0]int gi 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.0.33 28
[R2-GigabitEthernet0/0/1]q
[R2]ip route-static 192.168.0.96 28 192.168.0.18
[R2]ip route-static 192.168.0.80 28 192.168.0.34
[R2]ip route-static 192.168.0.48 28 192.168.0.34
[R2]ip route-static 192.168.0.64 28 192.168.0.34
[R2]ip route-static 192.168.0.112 28 192.168.0.18
[R2]ip route-static 192.168.0.128 28 192.168.0.18
[R2]ip route-static 192.168.0.0 28 192.168.0.18
[R2]ip route-static 0.0.0.0 0 192.168.0.34
R3:
[R3]int gi 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.0.34 28
[R3-GigabitEthernet0/0/0]int gi 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.0.81 28
[R3-GigabitEthernet0/0/1]int gi 4/0/0
[R3-GigabitEthernet4/0/0]ip add 192.168.0.49 28
[R3]int gi 0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.0.65 28
[R3]ip route-static 192.168.0.112 28 192.168.0.82
[R3]ip route-static 192.168.0.16 28 192.168.0.33
[R3]ip route-static 192.168.0.96 28 192.168.0.82
[R3]ip route-static 192.168.0.128 28 192.168.0.82
[R3]ip route-static 192.168.0.0 28 192.168.0.33
[R3]ip route-static 192.168.0.0 28 192.168.0.82
[R3]ip route-static 0.0.0.0 0 192.168.0.50 preference 80
[R3]ip route-static 0.0.0.0 0 192.168.0.66
R4:
[R4]int gi 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.0.97 28
[R4-GigabitEthernet0/0/1]int gi 0/0/2
[R4-GigabitEthernet0/0/2]ip add 192.168.0.82 28
[R4-GigabitEthernet0/0/2]q
[R4]int gi 0/0/0.1
[R4-GigabitEthernet0/0/0.1]ip add 192.168.0.113 28
[R4-GigabitEthernet0/0/0.1]q
[R4]int gi 0/0/0.2
[R4-GigabitEthernet0/0/0.2]ip add 192.168.0.129 28
[R4]int gi 0/0/0.1
[R4-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R4-GigabitEthernet0/0/0.1]arp broadcast enable
[R4-GigabitEthernet0/0/0.1]int gi 0/0/0.2
[R4-GigabitEthernet0/0/0.2]dot1q termination vid 3
[R4-GigabitEthernet0/0/0.2]arp broadcast enable
[R4]dhcp enable
[R4]ip pool haha
[R4-ip-pool-haha]network 192.168.0.112 mask 28
[R4-ip-pool-haha]gateway-list 192.168.0.113
[R4-ip-pool-haha]dns-list 8.8.8.8
[R4-ip-pool-haha]q
[R4]ip pool hahaha
[R4-ip-pool-hahaha]network 192.168.0.128 mask 28
[R4-ip-pool-hahaha]gateway-list 192.168.0.129
[R4-ip-pool-hahaha]dns
[R4-ip-pool-hahaha]dns-list 8.8.8.8
[R4-ip-pool-hahaha]q
[R4]int gi 0/0/0.1
[R4-GigabitEthernet0/0/0.1]dhcp select global
[R4-GigabitEthernet0/0/0.1]q
[R4]int gi 0/0/0.2
[R4-GigabitEthernet0/0/0.2]dhcp select global
[R4-GigabitEthernet0/0/0.2]q
[R4]ip route-static 192.168.0.32 28 192.168.0.81
[R4]ip route-static 192.168.0.16 28 192.168.0.98
[R4]ip route-static 192.168.0.48 28 192.168.0.81
[R4]ip route-static 192.168.0.64 28 192.168.0.81
[R4]ip route-static 192.168.0.0 28 192.168.0.98
[R4]ip route-static 0.0.0.0 0 192.168.0.81
R5:
[R5]int gi 0/0/1
[R5-GigabitEthernet0/0/1]ip add 192.168.0.50 28
[R5-GigabitEthernet0/0/1]q
[R5]int gi 0/0/0
[R5-GigabitEthernet0/0/0]ip add 192.168.0.66 28
[R5-GigabitEthernet0/0/0]int gi 0/0/2
[R5-GigabitEthernet0/0/2]ip add 100.1.1.5 24
[R5-GigabitEthernet0/0/2]q
[R5]ip route-static 192.168.0.32 28 192.168.0.49
[R5]ip route-static 192.168.0.80 28 192.168.0.49
[R5]ip route-static 192.168.0.16 28 192.168.0.49
[R5]ip route-static 192.168.0.96 28 192.168.0.49
[R5]ip route-static 192.168.0.112 28 192.168.0.49
[R5]ip route-static 192.168.0.128 28 192.168.0.49
[R5]acl 2000
[R5-acl-basic-2000]rule 5 permit source any
[R5-acl-basic-2000]q
[R5]int gi 0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000
[R5-GigabitEthernet0/0/2]q
[R5]ip route-static 0.0.0.0 0 100.1.1.6
[R5]ip route-static 192.168.0.0 28 192.168.0.49
[R5]ip route-static 192.168.0.0 28 192.168.0.65
R6:
[ISP]int gi0/0/0
[ISP-GigabitEthernet0/0/0]ip add 100.1.1.6 24
[ISP-GigabitEthernet0/0/0]q
SW1:
[SW1]vlan 2
[SW1-vlan2]vlan 3
[SW1-vlan3]q
[SW1]
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 2
[SW1-Ethernet0/0/2]q
[SW1]int e 0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 3
[SW1]int e 0/0/1
[SW1-Ethernet0/0/1]port link-type trunk
[SW1-Ethernet0/0/1]port trunk allow-pass vlan all
[SW1-Ethernet0/0/1]q
[SW1]int e 0/0/4
[SW1-Ethernet0/0/4]port link-type trunk
[SW1-Ethernet0/0/4]port trunk allow-pass vlan all
SW2:
[SW2]vlan 2
[SW2-vlan2]vlan3
[SW2-vlan3]
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 2
[SW2-Ethernet0/0/2]q
[SW2]int e 0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 3
[SW2-Ethernet0/0/3]q
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan all
[SW2-Ethernet0/0/1]q
实验结果