交换机LSW1配置
1. 创建VLAN
进入系统视图: system - view
创建VLAN 2、3、20、30: vlan batch 2 3 20 30
2. 配置接口类型及加入VLAN
GE0/0/1 - GE0/0/4接口配置为Trunk口并允许相关VLAN通过:
interface GigabitEthernet0/0/1
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/2
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/3
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/4
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
GE0/0/5配置为Trunk口,允许VLAN通过:
interface GigabitEthernet0/0/5
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
3. 配置VLANIF接口(网关)
配置VLAN 2的网关:
plain
interface Vlanif2
ip address 10.0.2.1 24
quit
配置VLAN 3的网关:
interface Vlanif3
ip address 10.0.3.1 24
quit
4. 配置生成树协议(STP)
开启STP: stp enable
设置为VLAN 2和VLAN 3的根桥:
stp instance 1 root primary
stp instance 2 root primary
配置与LSW2的备份关系:
stp instance 3 root secondary
stp instance 4 root secondary
交换机LSW2配置
1. 创建VLAN
进入系统视图: system - view
创建VLAN 2、3、20、30: vlan batch 2 3 20 30
2. 配置接口类型及加入VLAN
GE0/0/1 - GE0/0/4接口配置为Trunk口并允许相关VLAN通过:
interface GigabitEthernet0/0/1
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/2
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/3
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/4
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
GE0/0/5配置为Trunk口,允许VLAN通过:
interface GigabitEthernet0/0/5
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
3. 配置VLANIF接口(网关)
配置VLAN 20的网关:
interface Vlanif20
ip address 10.0.20.1 24
quit
配置VLAN 30的网关:
interface Vlanif30
ip address 10.0.30.1 24
quit
4. 配置生成树协议(STP)
开启STP: stp enable
设置为VLAN 20和VLAN 30的根桥:
stp instance 3 root primary
stp instance 4 root primary
配置与LSW1的备份关系:
stp instance 1 root secondary
stp instance 2 root secondary
交换机LSW3和LSW4配置
1. 创建VLAN
- 进入系统视图: system - view
- 创建VLAN 2、3、20、30: vlan batch 2 3 20 30
2. 配置接口类型及加入VLAN
- 连接PC的接口配置为Access口并加入相应VLAN:
- 假设LSW3的GE0/0/1连接PC1(VLAN 2):
interface GigabitEthernet0/0/1
port link - type access
port default vlan 2
quit
- 假设LSW3的GE0/0/2连接PC2(VLAN 3):
interface GigabitEthernet0/0/2
port link - type access
port default vlan 3
quit
- 假设LSW4的GE0/0/1连接PC3(VLAN 20):
interface GigabitEthernet0/0/1
port link - type access
port default vlan 20
quit
- 假设LSW4的GE0/0/2连接PC4(VLAN 30):
interface GigabitEthernet0/0/2
port link - type access
port default vlan 30
quit
- 连接其他交换机的接口配置为Trunk口并允许相关VLAN通过:
interface GigabitEthernet0/0/3
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
interface GigabitEthernet0/0/4
port link - type trunk
port trunk allow - pass vlan 2 3 20 30
quit
路由器AR1配置
1. 配置接口IP地址
- GE0/0/0接口:
interface GigabitEthernet0/0/0
ip address 202.1.1.1 30
quit
- GE0/0/1接口:
interface GigabitEthernet0/0/1
ip address 10.0.0.1 30
quit
- GE0/0/2接口:
interface GigabitEthernet0/0/2
ip address 10.0.0.5 30
quit
2. 配置静态路由
- 配置到VLAN 2、3、20、30的静态路由:
ip route - static 10.0.2.0 24 10.0.0.2
ip route - static 10.0.3.0 24 10.0.0.2
ip route - static 10.0.20.0 24 10.0.0.6
ip route - static 10.0.30.0 24 10.0.0.6
- 配置默认路由到ISP:
ip route - static 0.0.0.0 0 202.1.1.2
ISP路由器配置(假设)
1. 配置接口IP地址
- GE0/0/0接口:
interface GigabitEthernet0/0/0
ip address 202.1.1.2 30
quit
- 配置连接外部网络的接口(假设为GE0/0/1):
interface GigabitEthernet0/0/1
ip address 100.100.100.100 24
quit
2. 配置静态路由(假设连接外部网络有相应需求)
- 配置到企业内部网络的静态路由:
ip route - static 10.0.2.0 24 202.1.1.1
ip route - static 10.0.3.0 24 202.1.1.1
ip route - static 10.0.20.0 24 202.1.1.1
ip route - static 10.0.30.0 24 202.1.1.1