Professional Documents
Culture Documents
10inter VLANCommunication
10inter VLANCommunication
Contents
1 Background
• Inter-VLAN Communication
Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Inter-VLAN Communication (1)
• In real-world network deployments, different IP address segments are assigned to different VLANs.
• PCs on the same network segment in the same VLAN can directly communicate with each other without
the need for Layer 3 forwarding devices. This communication mode is called Layer 2 communication.
• Inter-VLAN communication belongs to Layer 3 communication, which requires Layer 3 devices.
Layer 2 switch
Layer 2 Layer 2
communication communication
VLAN 10 VLAN 20
192.168.10.0/24 192.168.20.0/24
Layer 3 communication
Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Inter-VLAN Communication (2)
• Common Layer 3 devices: routers, Layer 3 switches, firewalls, etc.
• Inter-VLAN communication is implemented by connecting a Layer 2 switch to a Layer 3
interface of a Layer 3 device. The communication packets are routed by the Layer 3 device.
3
3
2 Layer 2 interface
Router 2
3 Layer 3 interface 2
Layer 2 switch 2
2
2 2
VLAN 10 VLAN 20
192.168.10.0/24 192.168.20.0/24
Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1 Background
Page 6 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Using a Router's Physical Interfaces
Physical Connection
R1
GE0/0/1 GE0/0/2
192.168.10.254 192.168.20.254
GE0/0/3 GE0/0/4
Access (VLAN 10) Access (VLAN 20)
GE0/0/1 GE0/0/2
Access (VLAN 10) Access (VLAN 20)
SW1
VLAN 10 VLAN 20
PC1 PC2
192.168.10.2/24 192.168.20.2/24
Default gateway: Default gateway:
192.168.10.254 192.168.20.254
Page 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Using a Router's Sub-interfaces
Physical Connection
R1
GE0/0/1.10 GE0/0/1.20
192.168.10.254 192.168.20.254
G0/0/24
Trunk VLAN 10 20
GE0/0/1 GE0/0/2
Access (VLAN 10) SW1 Access (VLAN 20)
VLAN 10 VLAN 20
PC1 PC2
192.168.10.2/24 192.168.20.2/24
Default gateway: Default gateway:
192.168.10.254 192.168.20.254
Page 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sub-Interface Processing
GE0/0/1 R1 GE0/0/1.10
R1 GE0/0/1
GE0/0/1.20
Page 9 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Example for Configuring Sub-interfaces
[R1]interface GigabitEthernet0/0/1.10
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/1.10]ip address 192.168.10.254 24
R1 [R1-GigabitEthernet0/0/1.10]arp broadcast enable
Trunk
GE0/0/24
[R1]interface GigabitEthernet0/0/1.20
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
SW1 [R1-GigabitEthernet0/0/1.20]ip address 192.168.20.254 24
[R1-GigabitEthernet0/0/1.20]arp broadcast enable
Page 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1 Background
Page 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Layer 3 Switch and VLANIF Interfaces
Layer 3 switch
Routing module
VLANIF 10 Direct internal VLANIF 20
communication
Page 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Example for Configuring VLANIF Interfaces
• VLANIF10 192.168.10.254/24 Basic configurations:
• VLANIF20 192.168.20.254/24 [SW1]vlan batch 10 20
[SW1] interface GigabitEthernet 0/0/1
SW1 [SW1-GigabitEthernet0/0/1] port link-type access
Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
VLANIF Forwarding Process (1)
interface Vlanif10 interface Vlanif20
ip address 192.168.10.254 24 ip address 192.168.20.254 24
(MAC:MAC2) (MAC:MAC2)
Switching
VLAN 10 VLAN 20
module
1
Access Port
PC1 PC2
IP: 192.168.10.2/24 IP: 192.168.20.2/24
Default gateway: Default gateway:
192.168.10.254 192.168.20.254
MAC: MAC1 MAC: MAC3
Page 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
VLANIF Forwarding Process (2)
interface Vlanif10 3 interface Vlanif20
ip address 192.168.10.254 24 ip address 192.168.20.254 24
(MAC:MAC2) (MAC:MAC2)
2
Switching
VLAN 10 VLAN 20
module
Access Port
PC1 PC2
IP: 192.168.10.2/24 IP: 192.168.20.2/24
Default gateway: Default gateway:
192.168.10.254 192.168.20.254
MAC: MAC1 MAC: MAC3
Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
VLANIF Forwarding Process (3)
interface Vlanif10 interface Vlanif20
ip address 192.168.10.254 24 ip address 192.168.20.254 24
(MAC:MAC2) (MAC:MAC2)
4
Switching
VLAN 10 VLAN 20
module
5
Access Port
PC1 PC2
IP: 192.168.10.2/24 IP: 192.168.20.2/24
Default gateway: Default gateway: 192.168.20.254
192.168.10.254 MAC: MAC3
MAC: MAC1
Page 16 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1 Background
Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Network Topology
VLAN 10
PC1
IP: 192.168.10.2/24 R1
Default gateway:
192.168.10.254
SW1 SW2 NAT
GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
Server
2.3.4.5
VLAN 20
• VLANIF10 192.168.10.254 24
PC2
IP: 192.168.20.2/24 • VLANIF20 192.168.20.254 24
Default gateway: • VLANIF30 192.168.30.1 24
192.168.20.254
Page 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Logical Connection
路由器 Logical Connection
SW2 Switching R1
module
NAT
VLAN 30
Internet
Access Port
Trunk Port
Page 19 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Communication Process (1)
VLANIF10
IP: 192.168.10.254/24
MAC: MAC2
VLANIF30
IP: 192.168.30.1/24
MAC: MAC2
IP: 192.168.10.2/24
默认网关: 192.168.10.254 R1
MAC: MAC1 SW1 SW2 NAT
GE0/0/1 GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
VLAN 10 192.168.30.2 Server
MAC:MAC3 2.3.4.5
Source MAC: MAC1
PC Processing Destination MAC: MAC2
Before sending a packet to 2.3.4.5, VLAN tag: None
the PC sends the packet to its
gateway after determining that Source IP: 192.168.10.2
the destination IP address is not
on its network segment. Destination IP: 2.3.4.5
Page 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Communication Process (2)
VLANIF10
IP: 192.168.10.254/24
MAC: MAC2
VLANIF30
IP: 192.168.30.1/24
IP: 192.168.10.2/24 MAC: MAC2
Default gateway:
192.168.10.254 R1
MAC: MAC1 SW1 SW2 NAT
GE0/0/1 GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
VLAN 10 192.168.30.2 Server
MAC: MAC3 2.3.4.5
MAC地址 VLAN Port
MAC1 10 GE0/0/1
Source MAC: MAC1
MAC2 10 GE0/0/24
Destination MAC: MAC2
SW1 Processing VLAN tag: 10
After receiving the frame, SW1 searches the Source IP: 192.168.10.2
MAC address table for the destination MAC
address and forwards the frame. Destination IP: 2.3.4.5
Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Communication Process (3)
VLANIF10
IP: 192.168.10.254/24
MAC: MAC2
VLANIF30
IP: 192.168.30.1/24
IP: 192.168.10.2/24 MAC: MAC2
Default gateway:
192.168.10.254 R1
MAC: MAC1 SW1 SW2 NAT
GE0/0/1 GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
VLAN 10 192.168.30.2 Server
Destination Outbound
Next Hop MAC: MAC3 2.3.4.5
Routing table Network Interface
0.0.0.0/0 192.168.30.2 Vlanif30
SW2 Processing
After SW2 receives the frame, it finds that the destination MAC address is the MAC
address of its VLANIF 10 and sends the frame to the routing module, which then
searches the routing table for a route matching the destination IP address 2.3.4.5.
After finding that the matching route is a default route, the outbound interface is
VLANIF 30, and the next hop is 192.168.30.2, SW2 searches its ARP table to obtain
the MAC address corresponding to 192.168.30.2.
Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Communication Process (4)
VLANIF10
IP: 192.168.10.254/24
MAC: MAC2
VLANIF30
IP: 192.168.30.1/24
IP: 192.168.10.2/24 MAC: MAC2
Default gateway:
192.168.10.254 R1
MAC: MAC1 SW1 SW2 NAT
GE0/0/1 GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
VLAN 10 192.168.30.2 Server
Destination Outbound MAC: MAC3 2.3.4.5
MAC
Network Interface
ARP entry
192.168.30.2 MAC3 GE0/0/2 Source MAC: MAC2
SW2 Processing Destination MAC: MAC3
After finding the MAC address corresponding to 192.168.30.2, VLAN tag: None
SW2 replaces the source MAC address of the packet with the Source IP: 192.168.10.2
MAC address of VLANIF 30, and forwards the packet to the
switching module. The switching module searches the MAC Destination IP: 2.3.4.5
address table for the outbound interface and determines
whether the packet carries a VLAN tag.
Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Communication Process (5)
VLANIF10
IP: 192.168.10.254/24
MAC: MAC2
VLANIF30
IP: 192.168.10.2/24 IP: 192.168.30.1/24
MAC: MAC2
Default gateway:
192.168.10.254 R1
MAC: MAC1 SW1 SW2 NAT
GE0/0/1 GE0/0/1
ISP
GE0/0/24 GE0/0/2 GE0/0/0 1.2.3.4
VLAN 10 192.168.30.2 Server
MAC: MAC3 2.3.4.5
Page 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary
Page 26 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
More Information
• Comparison between Layer 2 and Layer 3 interfaces
A Layer 2 interface does not have a MAC address. A Layer 3 interface has a MAC address.
Page 27 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.