二层交换技术是发展比较成熟,二层交换机属数据链路层设备,可以识别数据包中的MAC地址信息,根据MAC地址进行转发,并将这些MAC地址与对应的端口记录在自己内部的一个地址表中

三层交换机就是具有部分路由器功能的交换机,三层交换机的最重要目的是加快大型局域网内部的数据交换,所具有的路由功能也是为这目的服务的,能够做到一次路由,多次转发。对于数据包转发等规律性的过程由硬件高速实现,而象路由信息更新、路由表维护、路由计算、路由确定等功能,由软件实现。三层交换技术就是二层交换技术+三层转发技术。传统交换技术是在OSI网络标准模型第二层——数据链路层进行操作的,而三层交换技术是在网络模型中的第三层实现了数据包的高速转发,既可实现网络路由功能,又可根据不同网络状况做到最优网络性能

 

二层交换机不同VLAN实现互通 (华为)

LSW1配置

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10 20
[Huawei]quit
[Huawei]interface Vlanif 10    
[Huawei-Vlanif10]ip address 192.168.10.1 24
[Huawei-Vlanif10]quit
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access     
[Huawei-GigabitEthernet0/0/1]port default vlan 10

[Huawei]interface Vlanif 20    
[Huawei-Vlanif10]ip address 192.168.20.1 24
[Huawei-Vlanif10]quit
[Huawei]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/1]port link-type access     
[Huawei-GigabitEthernet0/0/1]port default vlan 10

测试:

 两台三层交换机下同一vlan 内同一网段的主机之间的互通如下图pc1和pc2同为vlan1 ip在同一网段

LSW4配置:(不同的vlan中不能放相同的ip段)

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

[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk 
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[Huawei-GigabitEthernet0/0/2]q
<Huawei>save

LSW5配置:

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

[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk 
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[Huawei-GigabitEthernet0/0/2]q
<Huawei>save

pc配置:

测试:

两台三层交换机下同一vlan 内不同网段的主机之间的互通如下图pc1和pc2

由于主机不在同一网段,需要通过 静态协议路由配置

LSW6配置:

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 2 to 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]interface Ethernet 0/0/1    
[Huawei-Ethernet0/0/1]port link-type access 
[Huawei-Ethernet0/0/1]port default vlan 2
[Huawei-Ethernet0/0/1]quit
[Huawei]    
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type trunk     
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan 3
[Huawei-Ethernet0/0/2]quit
[Huawei]interface Vlanif 2    
[Huawei-Vlanif2]ip address 10.1.1.1 24
[Huawei-Vlanif2]quit
[Huawei]interface Vlanif 3    
[Huawei-Vlanif3]ip address 10.1.3.1 24
[Huawei-Vlanif3]quit    
[Huawei]ip route-static 10.1.2.0 255.255.255.0 10.1.3.2

LSW7配置:

<Huawei>system-view 
[Huawei]vlan batch 2 to 3    
[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type access 
[Huawei-Ethernet0/0/1]port default vlan 2    
[Huawei]interface Ethernet 0/0/2    
[Huawei-Ethernet0/0/2]port link-type trunk     
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan 3    
[Huawei]interface Vlanif 2    
[Huawei-Vlanif2]ip address 10.1.2.2 24
[Huawei-Vlanif2]q
[Huawei]    
[Huawei]interface Vlanif 3    
[Huawei-Vlanif3]ip address 10.1.3.2 24    
[Huawei]ip route-static 10.1.1.0 255.255.255.0 10.1.3.1
[Huawei]

pc6配置:

测试:

 

版权声明:本文为yinfutao原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/yinfutao/p/9636013.html