首页 > 技术文章 > 华为交换机配置静态路由

yinfutao 2018-09-12 15:02 原文

LSW8配置

<Huawei>system-view 
[Huawei]vlan batch 10 100
[Huawei]interface Vlanif 10    
[Huawei-Vlanif10]ip address 192.168.10.1 24
[Huawei-Vlanif10]quit
[Huawei]interface Vlanif 100    
[Huawei-Vlanif100]ip address 192.168.100.1 24
[Huawei-Vlanif100]quit

[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access     
[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access     
[Huawei-GigabitEthernet0/0/2]port default vlan 100

[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ip route-static 192.168.20.0 24 192.168.100.2

LSW9配置

<Huawei>system-view 
[Huawei]vlan batch 20 100
[Huawei]interface Vlanif 20    
[Huawei-Vlanif10]ip address 192.168.20.1 24
[Huawei-Vlanif10]quit
[Huawei]interface Vlanif 100    
[Huawei-Vlanif100]ip address 192.168.100.2 24
[Huawei-Vlanif100]quit

[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access     
[Huawei-GigabitEthernet0/0/1]port default vlan 20
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access     
[Huawei-GigabitEthernet0/0/2]port default vlan 100

[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ip route-static 192.168.10.0 24 192.168.100.1

 

 

测试LSW8

[Huawei]ping 192.168.20.1
  PING 192.168.20.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.20.1: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 192.168.20.1: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 192.168.20.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.20.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.20.1: bytes=56 Sequence=5 ttl=255 time=40 ms

  --- 192.168.20.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/38/60 ms

测试LSW9

[Huawei]ping 192.168.10.1
  PING 192.168.10.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.10.1: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 192.168.10.1: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 192.168.10.1: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 192.168.10.1: bytes=56 Sequence=4 ttl=255 time=50 ms
    Reply from 192.168.10.1: bytes=56 Sequence=5 ttl=255 time=40 ms

  --- 192.168.10.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/44/50 ms

 

推荐阅读