一:实验环境 1.1: 华为ensp软件 1.2: PC机和路由器及交换机 初始化状态的PC机和两台初始化状态的路由器,三台交换机 二:实验过程 2.1:配置设备 在ensp中,将PC机和路由器及交换机准备好并开启。 2.2 配置SW1交换机
[SW1] vlan batch 10 20
[SW1] interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]un sh
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]un sh
[SW1-Ethernet0/0/1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]un sh
[SW1-Ethernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]p l t
[SW1-GigabitEthernet0/0/2]p t a v a
[SW1-GigabitEthernet0/0/2]un sh
2.3 配置SW2交换机
[SW2]interface e0/0/1
[SW2-Ethernet0/0/1]p l a
[SW2-Ethernet0/0/1]p d v 10
[SW2-Ethernet0/0/1]un sh
[SW2-Ethernet0/0/1]interface e0/0/2
[SW2-Ethernet0/0/2]p l a
[SW2-Ethernet0/0/2]p d v 20
[SW2-Ethernet0/0/2]un sh
[SW2-Ethernet0/0/2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l t
[SW2-GigabitEthernet0/0/1]p t a v a
[SW2-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
[SW2-GigabitEthernet0/0/1]un sh
[SW2-Ethernet0/0/2]int g0/0/2
2.4 配置SW3交换机
vlan batch 10 20 30
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan all
unsh
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
un sh
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
interface Vlanif30
ip address 12.0.0.1 255.255.255.252
ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
2.5 配置SW4交换机
vlan batch 30 40
interface Ethernet0/0/1
port link-type access
port default vlan 30
un sh
interface Ethernet0/0/2
port link-type access
port default vlan 40
un sh
interface Eth-Trunk1
trunkport g0/0/1 to 0/0/2
port link-type trunk
port trunk allow-pass vlan all
un sh
2.6 配置R1单臂路由器
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.252
un sh
interface Eth-Trunk1
trunkport g 0/0/1 to 0/0/2
interface Eth-Trunk1
interface Eth-Trunk1.30
dot1q termination vid 30
ip address 192.168.30.1 255.255.255.0
arp broadcast enable
interface Eth-Trunk1.40
dot1q termination vid 40
ip address 192.168.40.1 255.255.255.0
arp broadcast enable
ip route-static 192.168.10.0 255.255.255.0 12.0.0.1
ip route-static 192.168.20.0 255.255.255.0 12.0.0.1
2.7 PC端测试