Configure the Ip Address and Default Gateway of Your Switch

In this article I will show you how to configure an Ip address and a default gateway in your manageable switch.

But first things first,

Why is an Ip address and default gateway needed in the switch?

After all switches are OSI Layer 2 devices that care only about MAC addresses.

The modern switches are manageable and support extra features than normal old fashion switches. This features include the support of TCP/IP applications like ping, telnet, trace route etc. For example, if you want to telnet or ping a switch, the switch must have an Ip configured. Also, if you want to execute ping or telnet to a device in another subnet the switch must have a default gateway configured.

Now let’s see the configuration for a 2950 series cisco switch.

Ip address

To configure the ip address first you have to enter from global configuration mode to interface vlan 1.

Switch#

Switch#conf t

Switch(config)#int vlan 1

Switch(config-if)#ip address {your ip address} {mask}

Switch(config-if)#no shutdown

Default Gateway

Be careful!!! The configuration of default gateway takes place in the configuration mode and the command does not include the mask for the ip.

Switch#

Switch#conf t

Switch(config)#ip default-gateway {ip address}

Now you can access your switch remotely, you can ping it from another network with different subnet and start “playing” with the settings. Have fun

19 Responses to “Configure the Ip Address and Default Gateway of Your Switch”

  1. 1a32604d39a5 says:

    1a32604d39a5…

    1a32604d39a519af31b4…

  2. Gab says:

    Thanks for this fast information, usefull.

  3. Manny says:

    So, How would we check the status of the default gateway that was configured on the switch?

  4. dude says:

    If i have more than one VLAN configured on the switch, what would be the default-gateway i configure on the switch ??? (each VLAN is in a different subnet …. )

  5. Sarfaraz says:

    this is very nice n easy articale to understandd n also to confugure

  6. dsd says:

    The default-gateway must your next hop ip, the way out of your lan

  7. Niranjan says:

    What is the command to check the ip from that switch..?

  8. khalid says:

    Really it’s simple and usefull.

  9. anil says:

    hi me anil….this is very nice and easy way configure a managable switch

  10. emmanuel vefonge says:

    I don’t know much about configuration but if i can have more of the configuration process about hub, routers and swithes i’ll be very happy i’ll get back to you people thanks verymuch i’m waiting for more example on how to do it once more i’m really happy.

  11. chandan sharma says:

    hi…this is chandan….its very easy thanks

  12. govi says:

    hi… its very simple… thankz

  13. Rafflea says:

    hi, i think it’s very useful. thank u

  14. loginuser0@gmail.com says:

    really helped

  15. Satyendra says:

    why do we configure the default gateway on switch??.we configured gateway on PC.

    As L2 switch does not understand the Ip address?

  16. Ashraf says:

    Thankxxx, for spreading knowledge. Keep it up.

  17. Henry says:

    @ Niranjan. the command to check the ip on switch is, from the global configuration mode type show run. i.e. switch(cinfig)#show run

  18. Remco says:

    Satyendra says:
    February 11, 2010 at 8:06 pm :

    “why do we configure the default gateway on switch??.we configured gateway on PC.

    As L2 switch does not understand the Ip address?”

    Answer : it is for management purposes and does not affect user traffic. What if you’d logon to a switch and ping or telnet from there? (this is common). The switch would not know what to do with it if it did not know a default gateway / router.

Leave a Reply