For a Cisco network switch, to change the
default gateway
address, i.e., to specify the IP address of a router that the switch will
use, enter privileged EXEC mode with the enable
command, then
enter configuration mode with the command configure terminal
and then set the default gateway address with the command ip
default-gateway gatewayIPAddress
where gatewayIPAddress
is the address for the router you wish the switch to use. Then exit
configuration mode with the end
command. To make the change
permanent, so that it will persist after a reboot of the switch, enter
the command write memory
.
Switch>enable Password: Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#ip default-gateway 192.168.1.1 Switch(config)#end Sep 23 01:26:53.415: %SYS-5-CONFIG_I: Configured from console by console Switch#write memory Building configuration... [OK] Switch#
You can view the default gateway address with the command
show ip default-gateway
.
Switch>show ip default-gateway 192.168.1.1 Switch>