Configuring an IP address and Default-Gateway on a Cisco Switch
The configuration of an IP address on a switch is slightly different from a router.
On a router we configure the IP address on the physical interface, however on a switch the physical interfaces are running at Layer 2 and hence don’t have IP addresses configured on them.
Even though a switch does not need an IP address to be able to switch packets, in order for you to connect to the switch via telnet or SSH you need to have a management IP address configured. Similarly, if you are connecting to the switch from a different subnet, the switch will require a default-gateway in order to have the packets routed back to you.
Since the IP address is not bound to any physical interface on the switch, we need to bind it to a logical interface. On a switch the logical interface is known as a ‘vlan interface’ (VLAN – Virtual LAN). This is similar to a loopback interface found on a Cisco router.
Here is the breakdown of the commands used in the live demo below.
AOIP.ORG_Switch# conf t
AOIP.ORG_Switch(config)# interface vlan 1
This enters the logical interface ‘vlan 1’. Vlan 1 is the native vlan and used for management purposes.
AOIP.ORG_Switch(config-if)# ip address 192.168.1.11 255.255.255.0
Assigns the ip address 192.168.1.11 to the interface
AOIP.ORG_Switch(config-if)# no shut
Activates the interface
AOIP.ORG_Switch(config-if)# exit
AOIP.ORG_Switch(config)# ip default-gateway 192.168.1.1
Defines a default-gateway for this switch.
Related posts:
- Configuring a Trunk port on a Cisco Switch
- Configuring an Access port on a Cisco switch
- Port Security on a Cisco Switch
- Configuring SPAN on a Cisco Switch
- Concept and Configuring VLAN’S


