What is the default Gateway?

Consider the following command and an abbreviated version of its output:
$ netstat -nr
Kernel IP routing table
Destination        Gateway            Genmask             Flags     Iface
192.168.165.0      0.0.0.0            255.255.255.0       U         eth0   
127.0.0.0          0.0.0.0            255.0.0.0           U         lo
0.0.0.0            192.168.165.1      0.0.0.0             UG        eth0

What is the default Gateway?

Consider the following command and an abbreviated version of its output:
$ netstat -nr
Kernel IP routing table
Destination        Gateway            Genmask             Flags     Iface
192.168.165.0      0.0.0.0            255.255.255.0       U         eth0   
127.0.0.0          0.0.0.0            255.0.0.0           U         lo
0.0.0.0            192.168.165.1      0.0.0.0             UG        eth0

What is the default Gateway?

A.
192.168.165.1

B.
255.0.0.0

C.
255.255.255.0

D.
0.0.0.0

E.
192.168.165.0

Explanation/Reference:
From http://www.freebsd.org/doc/handbook/network-routing.html:
For one machine to be able to find another over a network, there must be a mechanism in place to describe how to get from one to the other. This is called routing. A “route” is a defined pair of addresses: a “destination” and a “gateway”. The pair indicates that if you are trying to get to this destination, communicate through this gateway.

There are three types of destinations: individual hosts, subnets, and “default”. The “default route” is used if none of the other routes apply.

Consider this output of netstat
# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.165.0   *               255.255.255.0   U         0 0          0 eth0
link-local      *               255.255.0.0     U         0 0          0 eth0
default         192.168.165.1   0.0.0.0         UG        0 0          0 eth0
When you call netstat without the -n option you can see that 0.0.0.0 becomes "default", indicating the default route, and thus the default gateway.



Leave a Reply 0

Your email address will not be published. Required fields are marked *