Can anyone clarify gateway assignment for me?

What is the difference between adding a gateway as and assigning a specific IP address as a gateway?

  • Are you talking about as the destination gateway? Or as the network for the default gateway? I've never seen as the actual destination before, but have seen it as the network listed in the routing table.
    – kurtm
    Oct 8, 2013 at 4:03
  • @kurtm : I am asking about the assigning as a gateway and assigning a specific ip address as a gateway. Oct 8, 2013 at 4:08
  • Yeah. I got that with slm's answer. My systems don't print the, they substitute in something more meaningful. The answers below should explain it.
    – kurtm
    Oct 8, 2013 at 4:14

4 Answers 4

77 has the specific meaning "unspecified". This roughly translates to "there is none" in the context of a gateway. Of course, this assumes that the network is locally connected, as there is no intermediate hop. The machine will send the packet out that interface as though to a machine connected to that segment, which in Ethernet means the MAC address of the destination host will be used instead of the MAC address of the next hop gateway.

As a destination, is special: if there are no network bits, there can't be anything in the network number either. So, it's naturally unspecified. For prefix matching it masks off all bits, so all addresses are within; for this reason it's used to mean "default gateway" in routing tables. It is also the least-specific possible route, so selections that prioritize specificity will choose anything else available and match as a last resort.

However, sticking to your question, yes, it does have a special meaning. It means that the network is locally connected on that interface and no more hops are needed to get to it.


From the Wikipedia page of


In the Internet Protocol version 4 the address is a non-routable meta-address used to designate an invalid, unknown or non applicable target. To give a special meaning to an otherwise invalid piece of data is an application of in-band signaling.

From the Wikipedia page of Default Route.


The default route in Internet Protocol Version 4 (IPv4) is designated as the zero-address in CIDR notation, often called the quad-zero route. The subnet mask is given as /0, which effectively specifies all networks, and is the shortest match possible. A route lookup that does not match any other route, falls back to this route. Similarly, in IPv6, the default route is specified by ::/0.

In the highest-level segment of a network, administrators generally point the default route for a given host towards the router that has a connection to a network service provider. Therefore, packets with destinations outside the organization's local area network, typically destinations on the Internet or a wide area network, are forwarded to the router with the connection to that provider.

The device to which the default route points is often called the default gateway, and it often carries out other functions such as packet filtering, firewalling, or proxy server operations.


From your questioning, I'm going to assume that you have something like this:

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0     U         0 0          0 eth0         UG        0 0          0 eth0

This is saying that for each of the network destinations ( or that the default gateway is the destination, if a packet is NOT destined for any address within that particular network. For the destination, use the IP address

These rules act to funnel all the traffic that doesn't match any of the routes that we know about, to the default route.

Couple of examples

So say we have a packet with IP The first rule is checked and this IP matches that network, so it gets delivered.

If we had a packet, the 3rd rule would be in effect and the packet would be routed to

  • So in this example, all traffic would go to Aug 22, 2018 at 13:28
  • then why can't we use only last line instead of the previous two? i mean why we cant leave only last line
    – Estet
    Dec 16, 2020 at 21:17
  • @Estet because then you wouldn't be able to reach your local network.
    – winwin
    May 4, 2023 at 7:18
  • @TimothyPulliam it wouldn't. All traffic not matching the other two rules would.
    – winwin
    May 4, 2023 at 7:22

Look, is only used in routing tables--NOT for assigning to a host.

Hosts (computers with an IP address) maintain a routing table to resolve how to send their messages to the correct place.

Scenario 1: PC-A wants to send a message to PC-B on the SAME NETWORK:

1) PC-A checks its routing table to see if there is a match for the destination IP address. 2) The routing table shows that the destination is within the same network, finds the interface that is connected to that network, then forwards the message out that interface directly to the destination.

Scenario 2: PC-A wants to send a message to Server-Z on a REMOTE NETORK (NOT the same network):

1) PC-A checks its routing table and can't find a match (of course, because hosts don't keep track of hosts on remote networks--that's the routers' jobs).

2) However, the PC is configured with a quad-zero IP address and subnet mask mapped to your router (default gateway to OTHER, REMOTE, DIFFERENT networks) like this:

( interface)

What does zero mean? It means none. So, if your computer doesn't keep track of where remote hosts are, and it checks its routing table every time it wants to send a message to see if it needs to either send it to the SAME (local) network or if it needs to send it to a REMOTE network, then how does it get the message to the remote network?

It sends it to the router and lets the router do its job of routing the packet along the best path. So, the host/PC/computer needs to know that if it can't find an entry in its routing table for where to send the message (aka then it knows to send it to the router, which is the IP address associated with the ( interface) entry and uses the associated interface/NIC/Network Adapter that is connected to that.

Therefore, is used by routing tables on hosts and routers to know where to send something when it finds zero matches for how to reach a destination and must be mapped to a router's IP address and an interface to reach that router.


Basic explanation has the special meaning of Default Gateway but matches also the Destination entry.

At first glance, you can think that anyway everything is going through the Default Gateway. However, to fully understand the concept you must see it in the context of a device having multiple network interfaces (Ethernet, Wi-Fi, Bluetooth, ...).

As a Gateway

When is specified as the Gateway, it means: read the line with as the destination and route the packet through this interface.

But when you have a second network interface or more, you can have the IP of one of those network interfaces specified as the Gateway instead of, and packets will be routed through them.

As a Destination

The routing table is parsed to search the most specific destination (matching the highest prefix number).

At least, if no destination more specific is found, you will always match (CIDR notation equivalent to with a mask of, because if you make a binary comparison between the destination IP and the mask, it matches any IP address including the IP itself.

This is why is used as the default gateway entry and is especially useful when you have multiple possible gateways (multiple network interfaces on your device).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .