Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

Inter-VLAN Routing

Course Objectives

After completing this course, you will be able to:


• Understand the inter-VLAN communication mechanism.
• Implement inter-VLAN routing through sub-interfaces.
• Understand the working mechanism of Layer 3 switches.
• Implement inter-VLAN routing through VLANIF interfaces.
Contents

Inter-VLAN Routing Through Sub-interfaces

Inter-VLAN Routing Through VLANIF interfaces


Background
• A VLAN is a broadcast domain. Devices in the same VLAN can directly
communicate at Layer 2, while devices in different VLANs cannot directly
communicate. To allow devices in different VLANs to communicate, a Layer 3
routing device, such as a router or Layer 3 switch is needed.

Layer 2 communication

PC1 (VLAN10) PC2 (VLAN10) PC3 (VLAN20) PC4 (VLAN20)


192.168.10.1/24 192.168.10.2/24 192.168.20.1/24 192.168.20.2/24

VLAN10 VLAN20

Communication fails.
Inter-VLAN Routing Through a Router
Router

GE0/0/1 GE0/0/2
• The easiest way to implement inter-
192.168.10.254 192.168.20.254 VLAN communication is using a
router.

GE0/0/23
• In this example, the router uses one
GE0/0/24
physical interface to serve one VLAN.
G
E0
/1

/0 • The SW's GE 0/0/23 and GE 0/0/24


/0

/2
E0
G

SW
must be configured as access
interfaces, and each be added to a
specific VLAN.

PC1(VLAN 10) PC2(VLAN 20) • This method is easy to configure, but


192.168.10.1/24 192.168.20.1/24 has low scalability.
Gateway:192.168.10.254 Gateway:192.168.20.254
Inter-VLAN Routing Through Sub-interfaces
Router

GE0/0/1
GE0/0/1.10 GE0/0/1.20 • In this example, the router has more
192.168.10.254 192.168.20.254 than one sub-interface configured
for a physical interface, with one sub-
GE0/0/24 interface serving one VLAN.
(Trunk interface)
• A sub-interface is a software-based,
GE
/1
E 0/
0 0/
0/
2
logical interface. It is easy to add and
G
SW maintain sub-interfaces.

• The SW's GE 0/0/24 must be


configured as a trunk interface to
PC1(VLAN 10) PC2(VLAN 20)
carry traffic from multiple VLANs.
192.168.10.1/24 192.168.20.1/24
Gateway:192.168.10.254 Gateway:192.168.20.254
Creating Sub-interfaces on a Router’s Physical Interface

Interface GigabitEthernet 0/0/0.10


dot1q termination vid 10
ip address 192.168.10.254 24
arp broadcast enable

Switch Router
VLAN10

GE0/0/1

PC1
Trunk GE0/0/0
GE0/0/2
VLAN20

PC2

Interface GigabitEthernet 0/0/0.20


dot1q termination vid 20
ip address 192.168.20.254 24
arp broadcast enable
Creating Sub-interfaces on a Firewall’s Physical Interface
GE0/0/1

G0/0/1

GE0/0/1.10

GE0/0/1.20
G0/0/1 Trunk

GE0/0/1.10 GE0/0/1.20
vlan-type dot1q 10 vlan-type dot1q 20
ip address 192.168.10.1 24 ip address 192.168.20.1 24

VLAN 10 VLAN 20
Trust DMZ
Contents

Inter-VLAN Routing Through Sub-interfaces

Inter-VLAN Routing Through VLANIF interfaces


VLANIF Interface

Layer 3 switch

Router module interface vlanif 10


vlanif10 Vlanif20
interface vlanif 20

Switching module

10 10 20 20

VLAN 10 VLAN 20
Basic Configurations of VLANIF Interfaces

SW

G0/0/1 G0/0/2

PC1(VLAN 10) PC2(VLAN 20)


192.168.10.1/24 192.168.20.1/24
Gateway:192.168.10.254 Gateway:192.168.20.254

• PC1 belongs to VLAN10, and PC2 belongs to VLAN20.

• Configure the Layer 3 switch to allow PC1 and PC2 to communicate.


Basic Configurations of VLANIF Interfaces

• Configure the SW.


# Create VLANs 10 and 20. Add GE 0/0/1 to VLAN 10 and GE 0/0/2 to VLAN 20.
[SW] vlan batch 10 20
[SW] interface GigabitEthernet 0/0/1
[SW-GigabitEthernet0/0/1] port link-type access
[SW-GigabitEthernet0/0/1] port default vlan 10
[SW] interface GigabitEthernet 0/0/2
[SW-GigabitEthernet0/0/2] port link-type access
[SW-GigabitEthernet0/0/2] port default vlan 20
Basic Configurations of VLANIF Interfaces

• Configure the SW.


# Assign an IP address to VLANIF 10 and VLANIF 20 so that they can serve as the gateways for
VLANs 10 and 20.
[SW] interface vlanif 10
[SW-vlanif10] ip address 192.168.10.254 24
[SW] interface vlanif 20
[SW-vlanif20] ip address 192.168.20.254 24
Networking with Layers 2 and 3 Switches and a Router

GE0/0/0
192.168.99.2/24 Router

GE0/0/24

SW2 vlanif 10 192.168.10.254/24


vlanif 20 192.168.20.254/24
GE0/0/22 vlanif 99 192.168.99.1/24

GE0/0/22 • PC1 belongs to VLAN10 and PC2 belongs to


VLAN20. The gateways for the VLANs reside on
GE0/0/1 GE0/0/2
the core switch SW2.
SW1
• SW2 communicates with the router through
VLAN99.

• It is required that PC1 and PC2 be able to


PC1(VLAN 10) PC2(VLAN 20) communicate with each other and successfully ping
192.168.10.1/24 192.168.20.1/24
Gateway:192.168.10.254 Gateway:192.168.20.254 the router.
Logical Diagram

Layer 3 switch

Vlanif 10 Vlanif 20 Vlanif 99


GE0/0/22 GE0/0/24

T 99

Tr
Layer 2 switch

u
nk
GE0/0/1 GE0/0/2 GE0/0/22

10 20 T

T Trunk interface

10 20 99 Access interface
192.168.10.1/24 192.168.20.1/24
GW:192.168.10.254 GW:192.168.20.254
Configuration Example for Networking with Layers 2 and 3 Switches and a Router

• # Configure SW1.
[SW1] vlan batch 10 20
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] port link-type access
[SW1-GigabitEthernet0/0/1] port default vlan 10
[SW1] interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2] port link-type access
[SW1-GigabitEthernet0/0/2] port default vlan 20
[SW1] interface GigabitEthernet 0/0/22
[SW1-GigabitEthernet0/0/22] port link-type trunk
[SW1-GigabitEthernet0/0/22] port trunk allow-pass vlan 10 20
Configuration Example for Networking with Layers 2 and 3 Switches and a Router

• # Configure SW2.
[SW2] vlan batch 10 20 99
[SW2] interface GigabitEthernet 0/0/22
[SW2-GigabitEthernet0/0/22] port link-type trunk
[SW2-GigabitEthernet0/0/22] port trunk allow-pass vlan 10 20
# Configure GE 0/0/24 that connects to the router.
[SW2] interface GigabitEthernet 0/0/24
[SW2-GigabitEthernet0/0/24] port link-type access
[SW2-GigabitEthernet0/0/24] port default vlan 99(continued)
Configuration Example for Networking with Layers 2 and 3 Switches and a Router

• # Configure SW2.
[SW2] interface vlanif 10
[SW2-vlanif10] ip address 192.168.10.254 24
[SW2] interface vlanif 20
[SW2-vlanif20] ip address 192.168.20.254 24
[SW2] interface vlanif 99
[SW2-vlanif99] ip address 192.168.99.1 24
# Configure a default route destined for SW2, with the next hop being the router.
[SW2] ip route-static 0.0.0.0 0.0.0.0 192.168.99.2
Configuration Example for Networking with Layers 2 and 3 Switches and a Router

• # Configure the router.


[Router] interface GigabitEthernet 0/0/0
[Router-GigabitEthernet0/0/0] ip address 192.168.99.2 24
# Configure static routes destined for the network segments of VLANs 10 and 20
respectively for the return traffic.
[Router] ip route-static 192.168.10.0 24 192.168.99.1
[Router] ip route-static 192.168.20.0 24 192.168.99.1

You might also like