[an error occurred while processing this directive] FreeBSD Handbook : Advanced networking : Gateways and routes : Default routes
Previous: An example
Next: Dual homed hosts

12.1.2. Default routes

When the local system needs to make a connection to remote host, it checks the routing table to determine if a known path exists. If the remote host falls into a subnet that we know how to reach (Cloned routes), then the system checks to see if it can connect along that interface.

If all known paths fail, the system has one last option: the default route. This route is a special type of gateway route (usually the only one present in the system), and is always marked with a ``c'' in the flags field. For hosts on a local area network, this gateway is set to whatever machine has a direct connection to the outside world (whether via PPP link, or your hardware device attached to a dedicated data line).

If you are configuring the default route for a machine which itself is functioning as the gateway to the outside world, then the default route will be the gateway machine at your Internet Service Provider's (ISP) site.

Let's look at an example of default routes. This is a common configuration:

[Local2]  <--ether-->  [Local1]  <--PPP-->  [ISP-Serv]  <--ether-->  [T1-GW]

The hosts Local1 and Local2 are at your site, with the formed being your PPP connection to your ISP's Terminal Server. Your ISP has a local network at their site, which has, among other things, the server where you connect and a hardware device (T1-GW) attached to the ISP's internet feed.

The default routes for each of your machines will be:

host            default gateway        interface
----            ---------------        ---------
Local2          Local1                 ethernet
Local1          T1-GW                  PPP

A common question is ``Why (or how) would we set the T1-GW to be the default gateway for Local1, rather than the ISP server it is connected to?''.

Remember, since the PPP interface is using an address on the ISP's local network for your side of the connection, routes for any other machines on the ISP's local network will be automatically generated. Hence, you will already know how to reach the T1-GW machine, so there is no need for the intermediate step of sending traffic to the ISP server.

As a final note, it is common to use the address ``...1'' as the gateway address for your local network. So (using the same example), if your local class-C address space was 10.20.30 and your ISP was using 10.9.9 then the default routes would be:

Local2 (10.20.30.2)             -->  Local1 (10.20.30.1)
Local1 (10.20.30.1, 10.9.9.30)  -->  T1-GW (10.9.9.1)


FreeBSD Handbook : Advanced networking : Gateways and routes : Default routes
Previous: An example
Next: Dual homed hosts [an error occurred while processing this directive]