06-05-2015 06:39 PM - edited 03-08-2019 12:26 AM
Hi I saw the following:
" ------------------
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
------------------------ "
My question is why we still need to use command ip default-gateway since the router still can reach the switch from other network without the ip default-gateway.
Thank you
06-05-2015 10:41 PM
Hello,
Reza has given you the answer, however for an analogy, consider the switch as youe laptop/PC. It needs a default gateway to talk to other subnets other than local lan.
It is as simple as that.
Hope this helps.
Thanks,
Madhu.
06-06-2015 03:47 AM
It's debatable whether default-gateway command is needed on L2 switch. But it all depends on one thing. If the actual default gateway is enabled for proxy arp/auto arp response, then automatically the reachability to the switch from another subnet will indeed work - perhaps this is what's happening in your scenario. (without default-gateway command)
If proxy arp is disabled on the gateway, then you must have the default gateway command, like any other host that needs to reach another subnet, albeit sourced traffic or return traffic.
06-07-2015 02:47 PM
Hello
My understanding =
A switch running as a layer 2 device ( no ip routing enabled) is basically a "host" just like a pc.
Now if you would like to access a network device to/from this switch remotely ( that is off a subnet other than vlan1 in your example) then a default-gateway would be required.
The reason being -
L2 switching deals with switching where the frame is sent to a DMAC ( destination mac address) in the same vlan (again in your case vlan 1)
(host) 192.168.0.9 to (host) 192.168.0.10 ( L2 switching)
L3 switching/routing = Where the DMAC is not on the same Vlan as the SMAC (source mac address) it needs to go to a device that has routing capabilities ( the address of the default-gateway)
A D/G is usually router or a switch with L3 processing capabilities which will perform route lookups and forward packets towards the remote destination or towards another router/l3 switch which is closer to the destination
As your switch will know the physical address of the D/G then routing ( inter vlan ) can occur and remote connectivity can be established to/from your switch just like a pc would do
(Host) 192.168.0.9 to 192.168.0.254 (D/G) to (host) 193.168.0.9 ( L3 switching)
res
Paul
06-07-2015 10:32 PM
Hi Paul, my understanding is different to yours.
The 'host' will broadcast out with a destination MAC as 00-00-00-00-00-00 with a destination IP of the remote host, when translated to Ethernet this ARP request turns to a L2 broadcast, ultimately it reaches the gateway. The gateway then responds saying destination IP of intended host, with the default gateways MAC address as the destination.
this only applies if proxy arp is enabled.
see here: http://www.cisco.com/c/en/us/support/docs/ip/dynamic-address-allocation-resolution/13718-5.html
06-09-2015 02:55 PM
Hello Bilal
Maybe I didnt explain it in a good way -( i never do .lol)
What i was trying to say is - Any destinaton outside the soucre vlan the packet will be sent to the DG ( if one is defined) via an arp lookup of the DG ip address - and then forwarded
However is no DG is not defined and proxy arp isnt enabled then the packet will be dropped.
res
Paul
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide