VLAN间路由之单臂路由

网络拓扑图如下:通过单臂路由来实现所有VLAN间网络互通

 在SW1 上配置命令:

<Huawei>system-view 
[Huawei]undo info-center enable         #关闭信息中心
[Huawei]vlan batch 10 20 30        #创建vlan 10,vlan 20,vlan 30
[Huawei]interface Ethernet 0/0/2        #进入接口
[Huawei-Ethernet0/0/2]port link-type access        #设置类型为access
[Huawei-Ethernet0/0/2]port default vlan 10        #划分至vlan 10
[Huawei-Ethernet0/0/2]quit
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 10
[Huawei-Ethernet0/0/3]quit

[Huawei]interface Ethernet 0/0/4
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 20
[Huawei-Ethernet0/0/4]quit
[Huawei]interface Ethernet 0/0/5
[Huawei-Ethernet0/0/5]port link-type access
[Huawei-Ethernet0/0/5]port default vlan 20
[Huawei-Ethernet0/0/5]quit

[Huawei]interface Ethernet 0/0/6
[Huawei-Ethernet0/0/6]port link-type access
[Huawei-Ethernet0/0/6]port default vlan 30
[Huawei-Ethernet0/0/6]quit

[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk 
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/1]quit

R1 上配置命令:

<Huawei>system-view 
[Huawei]sysname R1
[R1]undo info-center enable 
[R1]interface GigabitEthernet 0/0/0.10        #创建子接口.10,子接口名字可以随便起,范围从 1~4096
[R1-GigabitEthernet0/0/0.10]ip address 192.168.10.1 24    #子接口配置IP地址
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10    #子接口和vlan 10做绑定
[R1-GigabitEthernet0/0/0.10]arp broadcast enable    #子接口开启arp广播
[R1-GigabitEthernet0/0/0.10]quit 

[R1]interface GigabitEthernet 0/0/0.20        #创建子接口.20,子接口名字可以随便起,范围从 1~4096
[R1-GigabitEthernet0/0/0.20]ip address 192.168.20.1 24    #子接口设置IP地址
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20    #子接口和vlan 20做绑定
[R1-GigabitEthernet0/0/0.20]arp broadcast enable     #开启arp广播
[R1-GigabitEthernet0/0/0.20]quit 

[R1]interface GigabitEthernet 0/0/0.30
[R1-GigabitEthernet0/0/0.30]ip address 192.168.30.1 24  #子接口设置IP地址
[R1-GigabitEthernet0/0/0.30]dot1q termination vid 30  #子接口和vlan 30做绑定
[R1-GigabitEthernet0/0/0.30]arp broadcast enable
[R1-GigabitEthernet0/0/0.30]quit 

R1 查看路由表信息【可以看到已经有3条直连路由,下一跳分别指向各个vlan的子接口地址】:display ip routing-table

 

posted @ 2021-02-04 21:07  凡是過往;皆為序章  阅读(298)  评论(0编辑  收藏  举报