book2

4.3 Inter-VLAN Routing using Layer 3 Switches

4.3.1 Layer 3 Switch Inter-VLAN Routing

В enterprise networks чаще используют Layer 3 switches, а не router-on-a-stick.

Причина проста:

  • выше performance;
  • меньше latency;
  • лучше scalability.

Layer 3 switch умеет:

  • route between VLANs using SVIs;
  • превращать Layer 2 port в routed port.

routed port — port на Layer 3 switch, который работает как router interface, а не как switchport. networkterm

4.3.2 Layer 3 Switch Scenario

В этом сценарии один Layer 3 switch сам даёт default gateway для hosts из разных VLANs.

Пример:

VLANSVI IP Address
10192.168.10.1/24
20192.168.20.1/24

4.3.3 Layer 3 Switch Configuration

Пример конфигурации:

D1(config)# vlan 10
D1(config-vlan)# name LAN10
D1(config-vlan)# vlan 20
D1(config-vlan)# name LAN20
D1(config-vlan)# exit
 
D1(config)# interface vlan 10
D1(config-if)# description Default Gateway SVI for 192.168.10.0/24
D1(config-if)# ip address 192.168.10.1 255.255.255.0
D1(config-if)# no shutdown
D1(config-if)# exit
 
D1(config)# interface vlan 20
D1(config-if)# description Default Gateway SVI for 192.168.20.0/24
D1(config-if)# ip address 192.168.20.1 255.255.255.0
D1(config-if)# no shutdown
D1(config-if)# exit
 
D1(config)# interface GigabitEthernet1/0/6
D1(config-if)# switchport mode access
D1(config-if)# switchport access vlan 10
D1(config-if)# exit
 
D1(config)# interface GigabitEthernet1/0/18
D1(config-if)# switchport mode access
D1(config-if)# switchport access vlan 20
D1(config-if)# exit
 
D1(config)# ip routing

interface vlan 10 ciscoIOScommand Создаёт SVI для VLAN 10.

ip routing ciscoIOScommand Включает IPv4 routing на Layer 3 switch.

Это критично:
без ip routing switch может иметь SVIs, но не будет нормально route between VLANs.

Частая ошибка

Создать SVI и забыть ip routing.

4.3.4 Layer 3 Switch Inter-VLAN Routing Verification

Здесь опять полезны:

  • ipconfig на host;
  • ping между VLANs.

Если hosts из разных VLAN пингуются, значит inter-VLAN routing уже работает.

4.3.5 Routing on a Layer 3 Switch

Если VLAN networks должны быть доступны другим Layer 3 devices, нужен routed uplink.

То есть один port можно перевести из switchport в Layer 3 interface.

Команда:

no switchport

no switchport ciscoIOScommand Отключает Layer 2 switchport behavior и превращает interface в routed port.

4.3.6 Routing Scenario on a Layer 3 Switch

В этом сценарии Layer 3 switch не только route’ит между VLANs локально, но и общается с внешним router.

Обычно для этого используют:

  • routed port;
  • static routing или dynamic routing protocol.

Здесь в примере используется OSPF.

OSPF (Open Shortest Path First) — динамический routing protocol. abbreviation

4.3.7 Routing Configuration on a Layer 3 Switch

Пример:

D1(config)# interface GigabitEthernet1/0/1
D1(config-if)# description routed Port Link to R1
D1(config-if)# no switchport
D1(config-if)# ip address 10.10.10.2 255.255.255.0
D1(config-if)# no shutdown
D1(config-if)# exit
 
D1(config)# ip routing
 
D1(config)# router ospf 10
D1(config-router)# network 192.168.10.0 0.0.0.255 area 0
D1(config-router)# network 192.168.20.0 0.0.0.255 area 0
D1(config-router)# network 10.10.10.0 0.0.0.3 area 0

router ospf 10 ciscoIOScommand Запускает OSPF process 10.

network 192.168.10.0 0.0.0.255 area 0 ciscoIOScommand Добавляет network в OSPF area 0.

4.3.8 Packet Tracer – Configure Layer 3 Switching and Inter-VLAN Routing

Это уже более “production-like” вариант inter-VLAN routing.

Если понял тему, то ты должен различать:

  • локальное inter-VLAN routing через SVIs;
  • внешнюю routed connectivity через routed port.

Итог темы

Layer 3 switch = SVIs for VLANs + ip routing + optional routed uplink