Hone

Lessons · Network switches · the default gateway

Reaching it from another subnet

`ip default-gateway` tells the switch where to send replies that are going outside its own subnet.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

Without it a switch answers anything on its own network and nothing from anywhere else, which looks exactly like a firewall problem and is not.

How to think about it

Set it to the router's address in the management VLAN. The test is whether somebody on a different subnet can reach the switch, not whether you can.

Worked example

enable
The # prompt.
configure terminal
Into configuration mode.
interface vlan 1
The management interface.
ip address 192.168.10.2 255.255.255.0
An address on the management network.
exit
Back to (config)#, because the gateway is a global setting, not an interface one.
ip default-gateway 192.168.10.1
The router. Replies to anywhere outside 192.168.10.0/24 now have somewhere to go.
end
Out.
show running-config
Both lines are there: the address under interface Vlan1, the gateway on its own at the bottom.

Your turn

Point the switch at the router at 192.168.10.1.

ip  192.168.10.1

The trap

Setting it inside `interface vlan 1`. It is global, and typing it in the wrong mode gives an invalid-input error that reads as though the command does not exist.

Next in Network switches

Every Network switches lesson on one page

Practise the default gateway on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.