What is a default gateway

Thanks Maher H for clarifying it.

For the case 1, does it require Router on Stick / SVI (or) we can just assign an ip in the same subnet range on the interface where switch is connected and will it just does routing between subnets ?

Hi Rene/Moderators,

With regards to this questions and answers
"
Hi Chris,

IP route is used on a router to enter something in its routing table. The effect will be the same…

Devices like switches don’t build a routing table so that’s when you need to use the ip default-gateway command. Also, on a router you can use it if you disable the routing table with “no ip routing”.

Rene
"

Am trying to fix some problems on L3 switches with ip routing enabled, which have eg.

ip default-gateway 10.10.10.10
and
ip route 0.0.0.0 0.0.0.0 20.20.20.20

Since ip routing is enabled, is the ip default-gateway 10.10.10.10 overridden?

Hello Ian.

This is a very good question. This often causes confusion.

The ip default-gateway command is used to allow the switch itself to communication with devices outside its subnet. If you have an SVI configured, say interface vlan 10 with an IP address of 10.10.10.5/24, in order for this interface to communicate with the administrator’s PC on another subnet for telnet or SSH connectivity, then it requires a default gateway. You would enter the command ip default-gateway 10.10.10.1. This is similar to the default gateway you configure on a PC. Note that this has NOTHING to do with the routing functionality of the L3 switch. This is called a default gateway.

The ip route 0.0.0.0 0.0.0.0 20.20.20.20command actually places this default route within the routing table and is used to route packets that enter and exit the L3 switch. This is called a default route.

I hope this has been helpful!!

Laz

1 Like

Awesome!

19 posts were merged into an existing topic: What is a default gateway

Rene, your explanation is the same as proxy arp concept ? i mean when a host forwards traffic of a host in another network to the default gateway.

Hi Juan,

There is an important difference between the two.

A host looks at a destination IP address and decides whether the destination is inside or outside its own subnet. When it’s outside its own subnet, it does an ARP request for the default gateway, gets a reply from the default gateway, then sends the IP packet to the default gateway.

With proxy ARP, a host thinks that the destination is in its own subnet while in reality, it’s not…it’s on another subnet. The host does an ARP request for the destination and the default gateway responds “on behalf” of the device on the other subnet.

On a LAN, proxy ARP works but it’s basically a misconfiguration issue where you have an incorrect subnet mask on a host.

Hope this helps!

Rene

Hi Renee,

I’m stuck in this lab for one week, I tried to solve the problem by myself but I failed to find a solution.

I have the same config as in the ‘default gateway course’ (it’s a physical lab)

HOST 1 : 192.168.1.1
R1(1841 ROUTER) fa0/0: 192.168.1.254; fa0/1: 192.168.2.254
HOST 2 :  192.168.2.1

Hosts run Windows 7, default gateway is correct, I can ping fa0/0 from host1, and fa0/1 from host2, and I can ping the hosts from the router

BUT I can’t reach fa0/1 from host 1, or host 2 from host 1, neither fa0/0 from host 2

What can I do to enable routing between these two networks?

Olivier

Hello Olivier

There are several things that come to mind that you can check.

  1. If you’re using a switch for this configuration, make sure that IP routing is enabled. If you’re using a router, then you can skip this.
  2. Verify that there are no access lists blocking traffic between subnets.
  3. Check the firewalls on the Windows devices and make sure they are not blocking the pings. Try disabling the firewalls and pinging again
  4. See if the problem is routing or the response to the ICMPs by pinging the gateway of the opposite network. For example, ping 192.168.2.254 from Host 1. If it doesn’t answer, the problem is in the router, not the destination host.
  5. Make sure the subnets are correct on the hosts (/24)

Try those out and let us know your results.

I hope this has been helpful!

Laz

Hi, Rene!
I intended to misconfigure the following two scenarios.

Topology I

Can you explain to me why the ping from PC1 to PC2 works even though I don’t have a gateway configured on PC1? (I intentionally put a “smaller” mask)
In theory it shouldn’t have worked.

Topology II



In this topology I chose to set the gateway from another subnet and it worked.Why?

Thanks!

Hello Robert

In both these cases, the mechanism that is allowing you to obtain connectivity is Proxy ARP. In the first case, PC1 is sending an ARP request for the destination IP, and R1 and R2 will send proxy ARP requests that eventually reach PC2. Via proxy ARP, R1 responds to PC1 and provides its own MAC address as the next hop L2 address.

In the second case, the host will send an ARP request for the configured gateway, and via the router, proxy ARP responds with the MAC address of the router on the local network.

Take a look at this lesson for more information:

I hope this has been helpful!

Laz

1 Like

Thanks , Lazaros Agapides!Your answer is very helpfull for me!

1 Like

Hi, Rene,


You wrote in good explaination!
And I got a few questions, why is the ip address of default gateway is 192.168.1.254 as shown in the picture, may I change the IP address to, like 192.168.1.253?
And for the understanding of this topic:
If two hosts are in the same network, means, both of them have the network portion, the sending host can get the destination MAC address of recieved hots by ARP, if not, I wil use first ARO to get the destination MAC address of the default gateway, and then do the step above again. does my understanding right?

Hello Heping

You can assign whatever IP address you want to the default gateway as long as it is a valid address within the specific IP subnet. Also, it cannot be the network or broadcast address. So yes, you can use 192.168.1.253 if you like. Typically you will find that many administrators choose to use either the first or last valid host address in the subnet for the default gateway. So you will often see either 192.168.1.1 or 192.168.1.254 for this particular subnet. But really you can use whatever you like.

Yes you are correct. If the destination is in the same subnet, the ARP request will get the MAC address of the destination host. If the destination is in a different subnet, the ARP request will request the MAC address of the default gateway that has been configured on the sending host.

I hope this has been helpful!

Laz