What is a default gateway

Hi Rene,

if it is L2 switch what will happen if i ping to to


will i be able configure default gateway … Please help me in understanding

Hi Durga,

Here’s what will happen:

  1. Your PC will check its own IP address and subnet mask and the destination IP address. It comes to the conclusion that the destination IP address it outside of its own subnet so it has to use the default gateway.
  2. If a default gateway has been configured then the computer will do an ARP for the IP address of the default gateway.
  3. If there is no default gateway then the computer will be unable to send the IP packet.

In other words, your computer requires a default gateway otherwise it won’t even send the packet. You’ll need an IP address that you can use as a default gateway (router or SVI interface on L3 switch for example).


Thanks for the explanation on default gateway. but my question is, what are the commands to configure the two interfaces of the Ethernet port?

Hi Emmanuel,

Here’s how you can do this on a Cisco IOS router:

R1(config)#interface FastEthernet 0/0
R1(config-if)#ip address
R1(config-if)#no shutdown
R1(config)#interface FastEthernet 0/1
R1(config-if)#ip address
R1(config-if)#no shutdown


I also like to set the speed to the required value and the duplex to full (we don’t use half duplex anymore) when configuring an interface. Leaving them at the defaults (auto) can cause problems in some circumstances. Also set switchports to mode access. Security best practise is to leave unused interfaces in the administratively set shutdown state.

on query


you replied

" t depends on the switch that you are using. If it’s an L2 switch then the only thing it does for your is “switching”. It will forward Ethernet frames based on the destination MAC address for different VLANs and that it’s."

sir my query is that
" on L2 switch if switch doesn’t connected with Router , communication between different vlans ( if all vlans reside/created on single L2 switch) is not possible , am i right? "
thanking you in anticipation

You are correct. Devices in two different VLANs require a layer 3 device in order to communicate. That could be a router, or a Layer 3 switch. If you have only, a layer 2 switch, communication would not happen.

Hi Rene,

I have two default gateways defined. Each of them are connected to two different ISPs. Now, if I type google.com in my browser, which gateway is selected and why?

Hi Shree,

It depends on the operating system. Windows for example uses a metric to choose between different default routes. A LAN interface will have a better metric than a wifi interface.

You can see this in the routing table btw, try the “route print” command from the Windows command prompt and you’ll see it.



Can some one explain me the packet switching in step by step for the below scenarios.

  1. Different Network :

Host A --------------- Switch -----------Router --------- Switch ---------- Host B

  1. Same Network :

Host A --------------- Switch -----------Router --------- Switch ---------- Host B


Hi Kaja,

In your case 1, if you mean that IP’s (which are on different subnet) are for HostA and HostB then the 2 hosts can reach each others because there is a Router in between which is L3 device, assuming that you have correct IP sets on the connected routers interfaces and correct IP gateway on each of the Hosts.

In your case 2, and again if you mean that IP’s are for HostA and HostB then this will not work because a Router cannot have on 2 of its interfaces the same range of IP.

Hope I could answer your question.

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”.


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

ip default-gateway
ip route

Since ip routing is enabled, is the ip default-gateway 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, 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 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 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!!



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!


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 :
R1(1841 ROUTER) fa0/0:; fa0/1:
HOST 2 :

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?


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 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!