05-02-2023 01:11 PM
So I have a network where I need to do inter-Vlan routing. I wanted to ping a PC from a switch and I understand why you would need to configure a default gateway on the switch so that the ping can be sent correctly but what I have trouble understanding is why the PC needs to also have a default-gateway configured on it, as the ICMP packet still reaches the PC but gets dropped without a default gateway configured on it.
05-02-2023 01:30 PM
Hi
You only need a default gateway when you are pinging from one network to another. For example, one PC is on the network 192.168.1.0 and the other on the network 192.168.2.0. In order to both ping each other they need have default gateway and the gateway must to know both network.
In your case, if you PC have ip address 192.168.1.2 and the switch have IP address of 192.168.1.1, they both dont need a default gateway as they are on the same network.
05-02-2023 02:13 PM
Technically you might not need a default gateway using the alternative approach described by @MHM Cisco World . What @Flavio Miranda describes is the norm.
05-03-2023 02:52 AM
When you set up a PC you set an IP address and mask so that the PC knows what network it is in. When the PC wants to send something to another device it will send arp request for the destination. If the destination device is in the same network the arp request should receive an arp response and communication will be successful. If the destination is in a different network (and if the PC does not have a default gateway) the arp request is sent using the destination address. Will that arp receive a response? Sometimes it might (especially if proxy arp is enabled on the L3 device doing forwarding for the network) and communication would be successful. But frequently it would not receive a response and communication would fail. Configuring default gateway for the PC provides a local address to use for arp requests when the destination is remote.
A couple of comments about proxy arp:
- many organizations disable proxy arp because of the security implications of proxy arp. So depending on proxy arp might work or might not.
- I have had experience with some hosts whose OS will not send arp requests for "remote" addresses.
So proxy arp might work, but it might not work. Why take a chance? Configuring a default gateway for the PC is the dependable way to assure that it can communicate with remote addresses.
05-03-2023 02:59 AM - edited 05-03-2023 03:04 AM
Rick suggests DG should be used to avoid possible issues when not using it. He is 100% correct, again though, there's an alternative which, if functional, negates "need" for a DG.
Oh, might add you can have multiple networks in same L2 domain. I.e. another network might not be L2 "remote" and I believe ARP alone will work, no need for a proxy. If fact, believe a DG will send a redirect to host, assuming redirects not disabled.
05-02-2023 01:55 PM
PC can work with default GW
and
PC can work without default GW<<- here you need to config the router interface with proxy-arp and in this case the PC send proxy-arp for any subnet outside it subnet IP.
05-02-2023 02:10 PM
A L2 switch is just another host, it too should work as @MHM Cisco World described.
05-03-2023 03:25 AM - edited 05-05-2023 07:51 AM
The reason the PC needs a default gateway configured on it is because the default gateway is the IP address of the device that the PC will use to reach destinations outside of its own subnet.
When you ping a PC from a switch, the ICMP packet is sent to the destination PC's IP address within its subnet. If the destination PC is on a different subnet, the packet will be sent to the default gateway for routing to the correct destination.
Without a default gateway configured on the PC , it will not know where to send packets destined for IP addresses outside of its own subnet, and those packets will be dropped. Therefore, it is important to configure the default gateway on both the switch and the PC for proper inter-VLAN routing to occur.
I hope this explanation helps clarify the role of default gateways in inter-VLAN routing.
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