实验需求
拓扑
分析
有两个VLAN,6个骨干链路,一个路由器上有环回,所以需要9个网段
不能使用动态路由,所以所有路由表都要手写
AR4的G0/0/2口需要加载两个虚拟子接口用来下放VLAN2和VLAN3
注意防环,AR2上的环回接口汇总后需要配置空接口防止路由黑洞
配置
1. AR4路由器VLAN及ip配置
LSW1的配置
[Huawei]sysname sw1
[sw1]
[sw1]vlan b 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]int e 0/0/2
[sw1-Ethernet0/0/2]p l a
[sw1-Ethernet0/0/2]port default v 2
[sw1-Ethernet0/0/2]port default v int e 0/0/3
[sw1-Ethernet0/0/3]p l a
[sw1-Ethernet0/0/3]p d v 3
[sw1-Ethernet0/0/3]int e 0/0/1
[sw1-Ethernet0/0/1]p l t
[sw1-Ethernet0/0/1]p t a v 2 3
[sw1-Ethernet0/0/1]int e 0/0/4
[sw1-Ethernet0/0/4]p l t
[sw1-Ethernet0/0/4]p t a
[sw1-Ethernet0/0/4]port trunk a
[sw1-Ethernet0/0/4]port trunk allow-pass vlan 2 3
LSW2配置
[Huawei]sys sw2
[sw2]
[sw2]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]int e 0/0/2
[sw2-Ethernet0/0/2]p l a
[sw2-Ethernet0/0/2]p d v 2
[sw2-Ethernet0/0/2]int e 0/0/3
[sw2-Ethernet0/0/3]p l a
[sw2-Ethernet0/0/3]p d v 3
[sw2-Ethernet0/0/3]int e 0/0/3
[sw2-Ethernet0/0/1]p l t
[sw2-Ethernet0/0/1]p t a v 2 3
AR4上划分子接口
[R4]int g 0/0/2.1
[R4-GigabitEthernet0/0/2.1]dot1q termination vid 2
[R4-GigabitEthernet0/0/2.1]ip address 192.168.0.145 28
[R4-GigabitEthernet0/0/2.1]arp broadcast enable
[R4-GigabitEthernet0/0/2.1]int g 0/0/2.2
[R4-GigabitEthernet0/0/2.2]ip address 192.168.0.161 28
[R4-GigabitEthernet0/0/2.2]dot1q termination vid 3
[R4-GigabitEthernet0/0/2.2]arp broadcast enable
使用动态主机配置协议(DHCP)为VLAN2和VLAN3配置ip
[R4]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R4]ip pool v1
Info: It's successful to create an IP address pool.
[R4-ip-pool-v1]network 192.168.0.144 mask 28
[R4-ip-pool-v1]gateway-list 192.168.0.145
[R4-ip-pool-v1]dns-list 114.114.114.114
[R4-ip-pool-v1]q
[R4]int g 0/0/2.1
[R4-GigabitEthernet0/0/2.1]dhcp select global
[R4-GigabitEthernet0/0/2.1]q
[R4]ip pool v2
Info: It's successful to create an IP address pool.
[R4-ip-pool-v2]network 192.168.0.160 mask 28
[R4-ip-pool-v2]gateway-list 192.168.0.161
[R4-ip-pool-v2]dns
[R4-ip-pool-v2]dns-list 114.114.114.114
[R4-ip-pool-v2]q
[R4]int g 0/0/2.2
[R4-GigabitEthernet0/0/2.2]dhcp select global
2. 路由器接口和环回IP配置
AR1
AR2
AR3
AR4
AR5
ISP
3. 写静态路由
AR1
[R1]ip route-static 192.168.0.0 28 192.168.0.17
[R1]ip route-static 192.168.0.128 28 192.168.0.17
[R1]ip route-static 192.168.0.112 28 192.168.0.34
[R1]ip route-static 192.168.0.96 28 192.168.0.34
[R1]ip route-static 192.168.0.64 28 192.168.0.34
[R1]ip route-static 192.168.0.144 28 192.168.0.17
[R1]ip route-static 192.168.0.144 28 192.168.0.34
[R1]ip route-static 192.168.0.160 28 192.168.0.17
[R1]ip route-static 192.168.0.160 28 192.168.0.34
AR2
[R2]ip route-static 192.168.0.32 28 192.168.0.18
[R2]ip route-static 192.168.0.64 28 192.168.0.18
[R2]ip route-static 192.168.0.96 28 192.168.0.130
[R2]ip route-static 192.168.0.64 28 192.168.0.130
[R2]ip route-static 192.168.0.96 28 192.168.0.18
[R2]ip route-static 192.168.0.112 28 192.168.0.130
[R2]ip route-static 192.168.0.144 28 192.168.0.130
[R2]ip route-static 192.168.0.160 28 192.168.0.130
AR3
[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.113
[R3]ip route-static 192.168.0.16 28 192.168.0.33
[R3]ip route-static 192.168.0.128 28 192.168.0.113
[R3]ip route-static 192.168.0.160 28 192.168.0.113
[R3]ip route-static 192.168.0.144 28 192.168.0.113
AR4
[R4]ip route-static 192.168.0.0 28 192.168.0.129
[R4]ip route-static 192.168.0.32 28 192.168.0.114
[R4]ip route-static 192.168.0.16 28 192.168.0.129
[R4]ip route-static 192.168.0.64 28 192.168.0.114
[R4]ip route-static 192.168.0.96 28 192.168.0.114
AR5
[R5]ip route-static 192.168.0.0 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.0 28 192.168.0.97
[R5]ip route-static 192.168.0.16 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.16 28 192.168.0.97
[R5]ip route-static 192.168.0.128 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.128 28 192.168.0.97
[R5]ip route-static 192.168.0.144 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.144 28 192.168.0.97
[R5]ip route-static 192.168.0.160 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.160 28 192.168.0.97
[R5]ip route-static 192.168.0.32 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.32 28 192.168.0.97
[R5]ip route-static 192.168.0.112 28 192.168.0.65 preference 61
[R5]ip route-static 192.168.0.112 28 192.168.0.97
4. 写R2的空接口
[R2]ip route-static 192.168.0.0 28 NULL 0
5. 写缺省路由
AR1
[R1]ip route-static 0.0.0.0 0 192.168.0.34
AR2
[R2]ip route-static 0.0.0.0 0 192.168.0.18
[R2]ip route-static 0.0.0.0 0 192.168.0.130
AR3
[R3]ip route-static 0.0.0.0 0 192.168.0.66 preference 61
[R3]ip route-static 0.0.0.0 0 192.168.0.98
AR4
[R4]ip route-static 0.0.0.0 0 192.168.0.114
AR5
[R5]ip route-static 0.0.0.0 0 100.1.1.2
ISP
[ISP]ip route-static 0.0.0.0 0 100.1.1.1
至此,全网可达
验证
game over