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

Assigns the ip address 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

Defines a default-gateway for this switch.


If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

Related posts:

  1. Configuring a Trunk port on a Cisco Switch
  2. Configuring an Access port on a Cisco switch
  3. Port Security on a Cisco Switch
  4. Configuring SPAN on a Cisco Switch
  5. Concept and Configuring VLAN’S

One Response to “Configuring an IP address and Default-Gateway on a Cisco Switch”

  1. binaryboy Says:

    Excellent explanation!!! I read other websites and couldn’t find a decent explanation. Thanks!!!

Leave a Reply