一、实验拓扑
二、实验要求
内网IP地址172.16.0.0/16合理分配
SW1/2之间互为备份
VRBP/STP/LANTRUNK均使用
所有PC通过DHCP获取ip地址
三、实验步骤
首先思考进行IP地址的规划
配置eht-trunk
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]q
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]eth-trunk[wa2]interface Eth-Trunk 0
[wa2-Eth-Trunk0]
[wa2-GigabitEthernet0/0/1]eth-trunk 0
[wa2-GigabitEthernet0/0/2]eth-trunk 0
查询 eht-trunk
创建VLAN
[sw1]vlan 2
[sw1-vlan2]
[sw2]vlan 2
[sw2-vlan2]
[sw3]vlan 2
[sw3-vlan2]
[sw4]vlan 2
[sw4-vlan2]
划分VLAN
[sw3-Ethernet0/0/4]port link-type access
[sw3-Ethernet0/0/4]port default vlan 2
[sw4-Ethernet0/0/4]port link-type access
[sw4-Ethernet0/0/4]port default vlan 2
配置trunk
[sw1]port-group group-member Eth-Trunk 0 Ethernet0/0/1 to Ethernet 0/0/2
[sw1-port-group]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 2
[wa2]port-group group-member Eth-Trunk 0 Ethernet0/0/1 to Ethernet 0/0/2
[wa2-port-group]port link-type trunk
[wa2-port-group]port trunk allow-pass vlan 2
[sw4]port-group group-member Ethernet0/0/1 to Ethernet 0/0/2
[sw4-port-group]port link-type trunk
[sw4-port-group]port trunk allow-pass vlan 2
[sw3]port-group group-member Ethernet0/0/1 to Ethernet 0/0/2
[sw3-port-group]port link-type trunk
[sw3-port-group]port trunk allow-pass vlan 2
查询配置是否成功
调整生成树
分组
[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
其他交换机配置一样
做备份
[sw1]stp instance 2 root secondary
[sw1]stp instance 1 root primary
[wa2]stp instance 2 root primary
[wa2]stp instance 1 root secondary
查询(仅展示部分)
调整用户接口类型
[sw3]port-group group-member Ethernet 0/0/3 to Ethernet 0/0/4
[sw3-port-group]stp edged-port enable
交换机4配置同理
配置SVI
[sw1]interface vlan 1
[sw1-Vlanif1]ip address 172.16.1.1 25[sw1]int vlan 2
[sw1-Vlanif2]ip address 172.16.1.129 25
[wa2]int vlan 1
[wa2-Vlanif1]ip address 172.16.1.2 25
[wa2]int vlan 2
[wa2-Vlanif2]
[wa2-Vlanif2]ip address 172.16.1.130 25
网关备份
[sw1]int vlan 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface Ethernet0/0/5 reduced 10
[wa2-Vlanif2]int vlan 1
[wa2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[wa2-Vlanif1]int vlan 2
[wa2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[wa2-Vlanif2]vrrp vrid 1 track interface Ethernet 0/0/5 reduced 10
查询配置是否成功
然后配置dhcp
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 8.8.8.8
[sw1]int vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.168.1.128 mask 25
[sw1-ip-pool-v2]gateway-list 172.16.1.254
[sw1-ip-pool-v2]dns-list 8.8.8.8
然后获取IP看配置是否成功
配置路由
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 172.16.0.1 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 172.16.0.5 30[sw1]vlan 20
[sw1-Vlanif20]ip address 172.16.0.2 30[sw1]int e0/0/5
[sw1-Ethernet0/0/5]port l a
[sw1-Ethernet0/0/5]p d vlan 20[wa2]vlan 20
[wa2-vlan20]q
[wa2]int e0/0/5
[wa2-Ethernet0/0/5]
[wa2-Ethernet0/0/5]port link-type access
[wa2-Ethernet0/0/5]port default vlan 20
[wa2-Vlanif20]ip address 172.16.0.6 30
然后配置ospf再配置去往外网缺省和nat的就可以ping通了