Lab network basis > ex. 11 > add default route

  • Part 11:
    I don’t think that it’s clear what is meant with “Add the default route via eth0 gateway.”
    I don’t think there is enough context to solve this with the previous learning material.

  • From the hints, I see we are supposed to add 172.16.238.1 as a gateway.
    I don’t think this gateway IP can be found elsewhere, except in the hints.
    (in other words, it seems unsolvable).

Also, I know it’s conventional to use .1 for gateways, but some people use .254, and if you subnet the less common ways, e.g. for less than 254 hosts, it will be other addresses as well. (Meaning, we shouldn’t assume .1 is the gatway our way to the gateway address).

Or am I overlooking something?

In Q10, you brought up eth0

If you do ip a to view the interfaces, e.g. to validate that eth0 is now present, you can see it has an IP address on the 172.16.238 network.

In Q3, you already determined what the default gateway for that network is, so this is why you use that IP.

Hello, I Have a question, what is the logic behind it, means we set default gateway to router’s IP in system right?, so why are we using 172.16.238.01 in answer , Please explain?

Because it is the default as seen from Q3

bob@caleston-lp10:~$ ip route
default via 172.16.238.1 dev eth0 
172.16.238.0/24 dev eth0 proto kernel scope link src 172.16.238.187 
172.16.239.0/24 dev eth1 proto kernel scope link src 172.16.239.187 
172.17.0.0/16 dev eth2 proto kernel scope link src 172.17.0.5 

It is the entry marked default

Just to confirm, is 172.16.238.1 the router’s IP address based on your last message?
I want to ensure I’ve understood correctly.

A default gateway is by definition a router.

The route table entries above, in order mean

  1. Default gateway - traffic to any address not known in any other route is sent there for routing. Note that if the default gateway itself isn’t directly connected to the requested IP on any of the other networks it is connected to, it will forward the request to the next default gateway on another network it is connected to.
  2. Traffic to any address in network 172.16.238.0/24 is sent via local network adapter eth0 as it is directly connected to that network
  3. Traffic to any address in network 172.16.239.0/24 is sent via local network adapter eth1 as it is directly connected to that network
  4. Traffic to any address in network 172.17.0.0/16 is sent via local network adapter eth2 as it is directly connected to that network

Now this machine itself can also function as a router because it is connected to more than one network. A machine on the 172.16.238.0/24 could have a route entry to get to 172.16.239.0/24 via 172.16.238.187