Default Gateway
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 11:11 PM
Hey guys,
I have starting recap of Routing and I have been using IP default gateway command on L2 switches but while doing lab I am not sure what it benefit is?
Can someone explain a bit under what scenarios this command is used.
- Labels:
-
Other Routing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 11:20 PM
you need this command to make sure you can access device's management IP from other networks.
Good luck
KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 11:25 PM
Hi Kasun,
Thank you for your response. Can you elaborate it a bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 11:53 PM
Hello,
consider the below example: Switch 1 is your access layer switch, with Vlan 99 being the management Vlan. Switch 2 is the distribution/core layer 3 switch:
Switch1
interface Vlan 99
ip address 192.168.99.2 255.255.255.0
!
ip default-gateway 192.168.99.1
Switch2
interface Vlan 99
ip address 192.168.99.1 255.255.255.0
So basically, the 'ip default-gateway' command is used to have connectivity for layer 2 devices...hope that makes sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 04:29 AM
you can configure management IP for switches. that IP can use to access switch remotely via telnet/SSH or web management. but when you access the switch IP from different network, switch should know a gateway to send different network return traffic. so we are configuring default gateway in switches.
Good luck
KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 12:01 AM
It is so you can connect to and manage the switch from a remote subnet.
If the device you were connecting to the switch from was in the same subnet you wouldn't need a default gateway but if it is in a different subnet the switch needs to know where to send the return traffic to and that is what it is for.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 07:56 AM
As @Jon Marshall notes, it's how you inform the switch, as a host, what gateway to use for non-locally connected networks. (Basically, the same as on a PC, when you configure its default-gateway.) (I believe you wouldn't need to use if if the local gateway device was doing proxy ARP.)
Since you mention "I have starting recap of Routing . . .", you might also have used or seen usage of a default route on L3 switches. That does for routing devices, much like default gateway does for non-routing devices. On a L2 switch, transit traffic is forwarded L2, i.e. no need for a L3 address. (Again, the default-gateway is for the switch, itself, as a host, to communicate with other devices on non-locally connected network.)
On a L3 routing device (i.e. L3 switch or router) the default route applies not only to locally generated device traffic, i.e. from the host device itself, but also to transit L3 traffic.
I recall (?) a Cisco L3 switch, when routing is enabled, default route will preempt default-gateway, but in theory, you could have both actively going to different next hops, i.e. again in theory, host generated traffic to default-gateway and transit L3 traffic to default route (assuming there's not a known destination network, or aggregate, better than the default).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 09:11 AM - edited 07-29-2022 09:11 AM
Hello
The most simplistic way of understanding a L2 switch - is think to of it as a PC (single host device)
Just like a pc that requires a ip address/subnet mask/default-gateway to be able to communicate externally a L2 switch requires exactly the same.
PC/ L2 switch
ip addresss x.x.x.x
subnet mask x.x.x.x
default-gateway x.x.x.x
Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.
Kind Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 12:37 PM
simple Lab two SW with and without GW,
as you can see Router can telnet to both SW whatever GW is config.
BUT note the proxy-arp is not disable in Router and Router in same Subnet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2022 01:07 AM
I would answer the original post by starting from some basic principles. A layer 2 switch forwards frames received from connected devices using mac addresses of source and destination. The layer 2 switch does not need any IP information for this forwarding to work. But the switch might want an IP address for management purposes (do you want to be able to telnet/ssh to the switch, do you want the switch to be able to send log messages to a syslog server, do you want the switch to be able to communicate with a network management server). So you could configure a vlan interface with an IP address for one of the vlans. For example
interface vlan 100
ip address 192.168.100.10 255.255.255.0
This would allow the layer 2 switch to communicate with any device that is in network 192.168.100.0. But how could the switch communicate with anything in a different network? To access destinations in remote networks you need to use the ip default-network command.
Rick
