Quiz Entry - updated: 2026.07.05
Why does a switch need a default gateway and how do you configure it?
A Layer 2 switch needs a default gateway only so its own management traffic (SSH/Telnet/HTTP) can reach an admin on another network; set it with the ip default-gateway ip-address global command.
Default Gateway on a Switch:
A Layer 2 switch needs a default gateway to be remotely managed from another network.
Why switches need a default gateway:
- Switch management traffic (Telnet, SSH, HTTP) originates from the switch
- Without a gateway, management is only possible from the local network
- The switch SVI (VLAN interface) needs an IP for management
Configuration command:
Switch(config)# ip default-gateway ip-address
Example:
S1(config)# interface vlan 1
S1(config-if)# ip address 192.168.10.50 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)# exit
S1(config)# ip default-gateway 192.168.10.1
Important distinction:
- Routers do NOT use
ip default-gateway- they use default routes (ip route 0.0.0.0 0.0.0.0 next-hop) - Switches use
ip default-gatewayfor management traffic only
Go deeper:
Default gateway (Wikipedia) — the gateway concept a switch needs so its own management traffic can leave the local network.
Static routing — default route (Wikipedia) — the
0.0.0.0/0default route routers use, contrasted with a switch'sip default-gateway.