What is a default gateway

When a host wants to reach a destination that is outside of its own network, it has to use a default gateway. We use a router or multilayer switch (that’s a switch that can do routing) as a default gateway.

In this lesson I’ll explain how a host knows when to use the default gateway or not and how it works behind the scenes. Let’s start with a simple example:

two hosts same subnet

Above we have two hosts connected to a switch. We only have network with subnet mask

When one host wants to send something to another host then it will check if the destination is inside or outside its own network. When the destination is in the same network then it will use ARP to find the MAC address of the destination and it can send the IP packet. How does the host check if the destination is in the same network? This is done by checking the subnet mask. For example, let’s say that wants to send an IP packet to

Source 11000000 10101000 00000001 00000001
Destination 11000000 10101000 00000001 00000010
Subnet mask 11111111 11111111 11111111 00000000

The subnet mask tells us which part of the IP address is the network and host part, the host that uses sees that is using the exact same network address and will know that it can use ARP to find the MAC address, create an Ethernet frame, encapsulate the IP packet and send it towards the switch.

Now let’s take a look at an example where we do require a default gateway. Take a look at this picture:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 739 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

525 Sign Ups in the last 30 days

100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!


Forum Replies

  1. Rene,

    Hello, normally I use the command
    ip route
    to define the default route, but there is another command,
    ip default-gateway
    also. What is the difference between the two commands?



  2. Hi Miguel,

    In the ARP table you only find MAC addresses of devices in the same subnet. When your PC wants to reach something that it not in the same subnet then it will send it to the default gateway. You will only find one entry in the ARP table for everything that is not in your own subnet: the router MAC and IP address, that’s it.


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

    ... Continue reading in our forum

  4. 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 tha

    ... Continue reading in our forum

  5. 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 fr
    ... Continue reading in our forum

22 more replies! Ask a question or join the discussion by visiting our Community Forum