目录
一、实验要求
1、内网IP地址172.16.0.0/16
2、SW1/2之间互为备份
3、VRRP/STP/VLAN/TRUNK均使用
4、所有PC通过DHCP获取IP地址
实验拓扑:
二、实验解析
1、对于地址172.16.0.0/16的划分如下:
vlan1:172.16.1.0/24 vlan2:172.16.2.0/24
R2的两个直连网段:172.16.3.0/24 172.16.4.0/24
2、实验配置步骤;1)channel 2)vlan 3)Trunk 4)STP 5)VRRP 6)DHCP
三、实验配置
1、SW1/2的channel
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]trunkport g0/0/1
[sw1-Eth-Trunk0]trunkport g0/0/2
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]trunkport g0/0/1
[sw2-Eth-Trunk0]trunkport g0/0/2
2、vlan的划分与创建以及Trunk
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]port link-type trunk
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]q
[sw1]int g0/0/4
[sw1-GigabitEthernet0/0/4]port link-type trunk
[sw1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/4]int g0/0/5
[sw1-GigabitEthernet0/0/5]port link-type trunk
[sw1-GigabitEthernet0/0/5]port trunk allow-pass vlan 2
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]port link-type trunk
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/4]port link-type trunk
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/4]int g0/0/5
[sw2-GigabitEthernet0/0/5]port link-type trunk
[sw2-GigabitEthernet0/0/5]port trunk allow-pass vlan 2
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/3]int e0/0/4
[sw3-Ethernet0/0/4]port link-type trunk
[sw3-Ethernet0/0/4]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]p d v 2
[sw4]vlan 2
[sw4-vlan2]q
[sw4]int e0/0/1
[sw4-Ethernet0/0/1]port link-type trunk
[sw4-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/1]int e0/0/5
[sw4-Ethernet0/0/5]port link-type trunk
[sw4-Ethernet0/0/5]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/2]int e0/0/3
[sw4-Ethernet0/0/3]port link-type access
[sw4-Ethernet0/0/3]p d v 2
4、STP配置
[sw1]stp enable
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
[sw2]stp enable
[sw2]stp region-configuration
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
[sw3]stp enable
[sw3]stp region-configuration
[sw3-mst-region]region-name a
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration
[sw4]stp enable
[sw4]stp region-configuration
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
5、SVI与VRRP的配置
SVI的IP配置
[sw1]int vlan 1
[sw1-Vlanif1]ip address 172.16.1.1 24
[sw1-Vlanif1]q
[sw1]int vlan 2
[sw1-Vlanif2]ip address 172.16.2.1 24
[sw2]int vlan 1
[sw2-Vlanif1]ip add
[sw2-Vlanif1]ip address 172.16.1.2 24
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]ip address 172.16.2.2 24
VRRP:
[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface g0/0/3
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[sw1-Vlanif2]vrrp vrid 2 track interface g0/0/3
[sw2]int vlan 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[sw2-Vlanif1]vrrp vrid 1 track interface g0/0/3
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[sw2-Vlanif2]vrrp vrid 2 priority 105
[sw2-Vlanif2]vrrp vrid 2 track interface g0/0/3
6、DHCP配置
[sw1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[sw1]ip pool a
Info:It's successful to create an IP address pool.
[sw1-ip-pool-a]network 172.16.1.0 mask 24
[sw1-ip-pool-a]gateway-list 172.16.1.254
[sw1]ip pool b
Info:It's successful to create an IP address pool.
[sw1-ip-pool-b]network 172.16.2.0 mask 24
[sw1-ip-pool-b]gateway-list 172.16.2.254
[sw1-Vlanif1]int vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global
7、核心层配置
[sw1]vlan 99
[sw1-vlan99]q
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]p d v 99
[sw1]int vlan 99
[sw1-Vlanif99]ip address 172.168.3.1 24
[sw2]vlan 99
[sw2-vlan99]q
[sw2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]p d v 99
[sw2]int vlan 99
[sw2-Vlanif99]ip address 172.16.4.1 24
R2:
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.3.2 24
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.4.2 24
[r2-GigabitEthernet0/0/2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.1 24
ISP:
[r1]int lo0
[r1-LoopBack0]ip add 1.1.1.1 24
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.2 24
OSPF:
[r2]ospf 1 router-id 1.1.1.1
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.3.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 172.16.4.2 0.0.0.0
[sw1]ospf 1 router-id 2.2.2.2
[sw1-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]network 172.16.2.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.1 0.0.0.0
[sw2]ospf 1 router-id 3.3.3.3
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 172.16.4.1 0.0.0.0
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0
NAT:
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r2-acl-basic-2000]int g0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000
四、实验截图
PC1的IP
PC4的IP
PC1上网