Options

IP default gateway in switch

zaheer_abbas81zaheer_abbas81 Member Posts: 1 ■□□□□□□□□□
Helo guys, need help to clear my understanding about "ip default-gateway" command in switch.

Can some 1 explain when and why we use this command in switch, because switch has an inbuilt feature known as "unicast flodding" which will send the packet to all ports if destination is unkown.

Thanks

Comments

  • Options
    WebmasterWebmaster Admin Posts: 10,292 Admin
    To be able to set up an IP connection to the switch from 'remote' networks. Just as you need a gateway and route to the switch if the switch is in another network (IP subnet), the switch needs to find its way back to your computer.

    From my upcoming TechLabs for switches"
    STEP 3. Configure an IP address for the switch
    To be able to manage the switch using telnet, you will need to configure it with an IP address. Instead of assigning an IP address to one of the switch ports, we are going to assign an IP address to the Management VLAN.

    Use the following commands to assign the IP address 192.168.1.254 to VLAN 1, which is the management VLAN by default:
    TEswitch1(config)#interface vlan 1
    TEswitch1(config-if)#ip address 192.168.0.9 255.255.255.0
    TEswitch1(config-if)#no shutdown


    If you need to be able to connect to the switch from other networks, you will also need to configure a default gateway address. For example, if the switch is connected to a router with the IP address 192.168.1.254, use the following command, in Global Configuration mode, to use it as the default gateway:
    TEswitch1(config-if)#exit
    TEswitch1(config)#ip default-gateway 192.168.0.254
  • Options
    Danman32Danman32 Member Posts: 1,243
    You are correct, the switch handles layer 2. In a nutshell, IP configuration in the switch is mainly for management purposes.

    A managed switch has to be accessed somehow. Switches that can be telnetted into, or have HTTP based management interface obviously need an IP address. If the switch and the host managing the switch are not on the same IP network, then the Telnet/HTTP packet has to be routed. In order for the switch to be able to send the response packets, it has to know where the router is to forward the packet to. That would be the default gateway.
Sign In or Register to comment.