VLAN、802.1QトランクとVLAN間の通信3 / 9
VLAN間のルーティング
同一VLANはレイヤー2で通信できるが、VLAN10の192.0.2.0/24からVLAN20の198.51.100.0/24への通信にはレイヤー3の転送が必要になる。L3スイッチでは次のようにSVIへゲートウェイのアドレスを設定する。
ip routing
interface Vlan10
ip address 192.0.2.1 255.255.255.0
no shutdown
interface Vlan20
ip address 198.51.100.1 255.255.255.0
no shutdown
SVIのline protocolはVLANの存在と、それに属する稼働ポートなどにも依存する。
show ip interface brief
show vlan brief
show interfaces trunk
1行目、2行目、3行目、show ip routeを照合する。
PCのdefault gatewayは自分のVLANのSVIであり、別VLANのSVIを直接指定しない。
ルーターで一本のリンクを共有する場合は、物理ポートを有効にし、VLANごとのサブインターフェースへencapsulation dot1Qとアドレスを設定する。スイッチ側は対応するVLANを運ぶトランクにする。
interface GigabitEthernet0/0
no shutdown
interface GigabitEthernet0/0.10
encapsulation dot1Q 10
ip address 192.0.2.1 255.255.255.0
interface GigabitEthernet0/0.20
encapsulation dot1Q 20
ip address 198.51.100.1 255.255.255.0