通过配置trunk链路和配置网关实现全网互通

实验目的:192.168.10.X 与 192.168.20.X 进行通信

实验拓扑:

通过配置trunk链路和配置网关实现全网互通_第1张图片

实验步骤:


[SW1]vlan batch 2 3    //创建vlan


[SW1]interface GigabitEthernet 0/0/1   //进入接口


[SW1-GigabitEthernet0/0/1]port link-type access  //改为Access链路


[SW1-GigabitEthernet0/0/1]port default vlan 2   //加入vlan 2


[SW1]interface GigabitEthernet 0/0/2


[SW1-GigabitEthernet0/0/2]port link-type access


[SW1]-GigabitEthernet0/0/2]port default vlan 3


[SW1]interface Vlanif 2   //进入vlan 2


[SW1-Vlanif2]ip address 192.168.10.254 24  //设置IP地址


[SW1-Vlanif2]undo shutdown  //开启端口


[SW1]interface Vlanif 3


[SW1-Vlanif3]ip address 192.168.20.254 24


[SW1-Vlanif3]undo shutdown


[SW1]interface GigabitEthernet 0/0/6  //进入接口


[SW1-GigabitEthernet0/0/6]port link-type trunk  //改为trunk链路


[SW1-GigabitEthernet0/0/6]port trunk allow-pass vlan 2 3  // 加入 vlan 2  3

-----------------------------------------------------------------------------------------------------------------------------------------------------


[SW2]vlan batch 2 3   


[SW2]interface GigabitEthernet 0/0/1 


[SW2-GigabitEthernet0/0/1]port link-type access 


[SW2-GigabitEthernet0/0/1]port default vlan 2  


[SW2]interface GigabitEthernet 0/0/2


[SW2-GigabitEthernet0/0/2]port link-type access


[SW2]-GigabitEthernet0/0/2]port default vlan 3


[SW2]interface GigabitEthernet 0/0/6  


[SW2-GigabitEthernet0/0/6]port link-type trunk  


[SW2-GigabitEthernet0/0/6]port trunk allow-pass vlan 2 3 

 

你可能感兴趣的:(华为网络设备配置技术)