【实验拓扑】
【实验要求】
实现跨网段互通
【实验配置】
SW1:system-view
[SW1]vlan batch 100 200
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 100
[SW1-Ethernet0/0/2]quit
[SW1]interface Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 100
[SW1-Ethernet0/0/3]quit
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]port default vlan 200
[SW1-Ethernet0/0/4]quit
[SW1]interface Ethernet0/0/5
[SW1-Ethernet0/0/5]port link-type access
[SW1-Ethernet0/0/5]port default vlan 200
[SW1-Ethernet0/0/5]quit
[SW1]interface Ethernet0/0/6
[SW1-Ethernet0/0/6]port link-type trunk
[SW1-Ethernet0/0/6]port trunk allow-pass vlan all
[SW1-Ethernet0/0/6]quit
SW2:system-view
[SW2]vlan batch 100 200
[SW2]interface Ethernet0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 100
[SW2-Ethernet0/0/2]quit
[SW2]interface Ethernet0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 200
[SW2-Ethernet0/0/3]quit
[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan all
[SW2-Ethernet0/0/1]quit
SW3-3L:system-view
[SW3-3L]vlan batch 10 20 30
[SW3-3L]interface GigabitEthernet 0/0/1
[SW3-3L-GigabitEthernet0/0/1]port link-type access
[SW3-3L-GigabitEthernet0/0/1]port default vlan 30
[SW3-3L-GigabitEthernet0/0/1]quit
[SW3-3L]interface GigabitEthernet 0/0/2
[SW3-3L-GigabitEthernet0/0/2]port link-type access
[SW3-3L-GigabitEthernet0/0/2]port default vlan 10
[SW3-3L-GigabitEthernet0/0/2]quit
[SW3-3L]interface GigabitEthernet 0/0/3
[SW3-3L-GigabitEthernet0/0/3]port link-type access
[SW3-3L-GigabitEthernet0/0/3]port default vlan 20
[SW3-3L-GigabitEthernet0/0/3]quit[SW3-3L]interface vlanif 10
[SW3-3L-Vlanif10]ip address 192.168.10.254 255.255.255.0
[SW3-3L-Vlanif10]undo shutdown
[SW3-3L-Vlanif10]quit
[SW3-3L]interface vlanif 20
[SW3-3L-Vlanif20]ip address 192.168.20.254 255.255.255.0
[SW3-3L-Vlanif20]undo shutdown
[SW3-3L-Vlanif20]quit
[SW3-3L]interface vlanif 30
[SW3-3L-Vlanif30]ip address 192.168.30.254 255.255.255.0
[SW3-3L-Vlanif30]undo shutdown
[SW3-3L-Vlanif30]quit
[SW3-3L]ip route-static 192.168.100.0 255.255.255.0 192.168.30.01
[SW3-3L]ip route-static 192.168.200.0 255.255.255.0 192.168.30.01
R1:system-view
[R1]interface GigabitEthernet 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 100
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]ip address 192.168.100.254 255.255.255.0
[R1-GigabitEthernet0/0/0.1]quit
[R1]interface GigabitEthernet 0/0/0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 200
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]ip address 192.168.200.254 255.255.255.0
[R1-GigabitEthernet0/0/0.2]quit
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.30.1 255.255.255.0
[R1-GigabitEthernet0/0/1]undo shutdown
[R1-GigabitEthernet0/0/1]quit
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.30.254
【验证】PC8pingPC1