Layer 3 Forwarding in Network Switches

Layer 3 forwarding enables switches to route IP packets between different VLANs and subnets, combining traditional switching with routing capabilities. 

Layer 3 switches make forwarding decisions based on IP addresses rather than MAC addresses, providing faster inter-VLAN routing than external routers.

Key Characteristics

Layer 3 forwarding features include:

  • IP routing: Routes packets between different subnets/VLANs
  • Hardware-based: Uses ASICs for wire-speed routing
  • SVI (Switched Virtual Interfaces): Virtual interfaces for each VLAN
  • Routing protocols: Supports OSPF, EIGRP, BGP, and static routing

How Layer 3 Forwarding Works

The switch examines the destination IP address in the packet header, consults its routing table, and forwards the packet to the appropriate interface or VLAN. This process happens in hardware at line rate, making it much faster than traditional router-on-a-stick configurations.

Configuration Examples

Basic Inter-VLAN Routing

! Enable IP routing globally
Switch(config)# ip routing

! Create VLAN 10
Switch(config)# vlan 10
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit

! Create VLAN 20
Switch(config)# vlan 20
Switch(config-vlan)# name Engineering
Switch(config-vlan)# exit

! Configure SVI for VLAN 10
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

! Configure SVI for VLAN 20
Switch(config)# interface vlan 20
Switch(config-if)# ip address 192.168.20.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit

Static Routing Configuration

! Add static route to remote network
Switch(config)# ip route 10.0.0.0 255.255.255.0 192.168.100.1

! Default route for internet access
Switch(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1

Dynamic Routing with OSPF

! Enable OSPF routing
Switch(config)# router ospf 1
Switch(config-router)# router-id 1.1.1.1
Switch(config-router)# network 192.168.10.0 0.0.0.255 area 0
Switch(config-router)# network 192.168.20.0 0.0.0.255 area 0
Switch(config-router)# exit

Layer 3 Physical Interface

! Configure routed port (no switching)
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.1.1.1 255.255.255.252
Switch(config-if)# no shutdown
Switch(config-if)# exit

Verification Commands

! Display routing table
Switch# show ip route

! Show interface IP configuration
Switch# show ip interface brief

! Verify routing protocols
Switch# show ip protocols

! Check CEF (Cisco Express Forwarding)
Switch# show ip cef

! Display ARP table
Switch# show ip arp

Common Use Cases

Layer 3 forwarding excels in:

  • Campus networks: Fast inter-VLAN routing in building distributions
  • Data centers: High-speed routing between server VLANs
  • Collapsed core designs: Combining routing and switching functions
  • Reducing latency: Hardware-based routing eliminates router bottlenecks

Best Practices

Use SVIs for VLAN routing and routed ports for WAN connections. Enable CEF for optimal performance. Implement routing protocols carefully to avoid loops. Always configure appropriate access lists for security between VLANs.

No comments:

Post a Comment