实验拓扑
拓扑搭建
vlan2 属于 instance1,vlan3 属于 instance2
1.对R1R2进行配置
[r1interface g0/0/2
[r1-GigabitEthernet0/0/2]ip address 12.1.1.1 24
[r1-GigabitEthernet0/0/2]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 13.1.1.1 24
[r1-GigabitEthernet0/0/0]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 14.1.1.1 24
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 32
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 2.2.2.2 32
[SW1]interface Vlanif 1
[SW1-Vlanif1]ip address 23.1.1.2 24
[SW2]interface Vlanif 1
[SW2-Vlanif1]ip address 34.1.1.2 24
2.接口汇聚
[lsw1]interface Eth-Trunk 1
[lsw1]interface g0/0/2
[lsw1-GigabitEthernet0/0/2]eth-trunk 1
[lsw1]interface g0/0/3
[lsw1-GigabitEthernet0/0/3]eth-trunk 1
[lsw1]interface g0/0/7
[lsw1-GigabitEthernet0/0/3]eth-trunk 1
[lsw2]interface Eth-Trunk 1
[lsw2]interface g0/0/2
[lsw2-GigabitEthernet0/0/2]eth-trunk 1
[lsw2-GigabitEthernet0/0/2]interface g0/0/3
[lsw2-GigabitEthernet0/0/3]eth-trunk 1
[lsw2-GigabitEthernet0/0/3]interface g0/0/7
[lsw2-GigabitEthernet0/0/7]eth-trunk 1
创建vlan2,vlan 3(选lsw1和lsw5命令展示)
[lsw1]undo terminal monitor
[lsw1]vlan 2
[lsw1-vlan2]q
[lsw1]vlan 3
[lsw1-vlan3]q
[lsw1]int g0/0/4
[lsw1-GigabitEthernet0/0/4]port link-t
[lsw1-GigabitEthernet0/0/4]port link-type access
[lsw1-GigabitEthernet0/0/4]port de
[lsw1-GigabitEthernet0/0/4]port default vlan 2
[lsw1-GigabitEthernet0/0/4]q
[lsw1]int g0/0/5
[lsw1-GigabitEthernet0/0/5]port link-t
[lsw1-GigabitEthernet0/0/5]port link-type access
[lsw1-GigabitEthernet0/0/5]port default vlan 3
[lsw1-GigabitEthernet0/0/5]q
[lsw1]int g0/0/6
[lsw1-GigabitEthernet0/0/6]port link-type trunk
[lsw1-GigabitEthernet0/0/6]port trunk allow-pass vlan 2 3
[lsw5]interface e0/0/1
[lsw5-Ethernet0/0/1]port link-type access
[lsw5-Ethernet0/0/1]port link-type trunk
[lsw5-Ethernet0/0/1]port trunk allow-pass vlan all
[lsw5-Ethernet0/0/1]interface e0/0/2
[lsw5-Ethernet0/0/2]port link-type trunk
[lsw5-Ethernet0/0/2]port trunk allow-pass vlan all
[lsw5-Ethernet0/0/2]interface e0/0/3
[lsw5-Ethernet0/0/3]port link-type access
[lsw5-Ethernet0/0/3]port default vlan 2
[lsw5-Ethernet0/0/3]interface e0/0/4
[lsw5-Ethernet0/0/4]port link-type access
[lsw5-Ethernet0/0/4]port default vlan 3
在lsw1和lsw2做MSTP(以lsw1命令展示)(vlan2 属于 instance1,vlan3 属于 instance2)
[lsw1]stp mode mstp
[lsw1]stp region-configuration
[lsw1-mst-region]region-name a
[lsw1-mst-region]instance 1 vlan 2
[lsw1-mst-region]instance 2 vlan 3
[lsw1-mst-region]active region-configuration
[lsw1]stp instance 1 root primary
[lsw1]stp instance 2 root secondary
配置ospf(以r1和lsw2展示)
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1]default-route-advertise
[r1]ip route-static 0.0.0.0 0 12.1.1.2
VRRP(以lsw1为例)
[lsw1]interface Vlanif 2
[lsw1-Vlanif2]vrrp vrid 1 virtual-ip 192.168.1.1
[lsw1-Vlanif2]ip address 192.168.1.1 24
[lsw1-Vlanif2]vrrp vrid 1 priority 120
[lsw1-Vlanif2]vrrp vrid 1 preempt-mode timer delay 20
[lsw1]interface Vlanif 3
[lsw1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.1.2
DHCP(以lsw1为例)
[lsw1]dhcp enable
[lsw1]ip pool 1
[llsw1-ip-pool-1]network 192.168.1.0 mask 24
[lsw1-ip-pool-1]gateway-list 192.168.1.1
[lsw1-ip-pool-1]dns-list 8.8.8.8
[lsw1]interface Vlanif 2
[lsw1-Vlanif2]dhcp select global
[lsw1]ip pool 2
[lsw1-ip-pool-2]network 172.16.1.0 mask 24
[lsw1-ip-pool-2]gateway-list 172.16.1.2
[lsw1-ip-pool-2]dns-list 8.8.8.8
[lsw1]interface Vlanif 3
[lsw1-Vlanif3]dhcp select global
配置nat(因为先前配过,但是不小心给关了,所以有个error,正常是不会有的(扣鼻))