RHCSA – The concept of default routes and DNS

Let’s say we have 2 networks:


You can find all my latest posts on medium.

IMG_20150501_195447~2Let’s say we have two networks,

Now the ip ranges of each network is:

Network 1 –
Network 2 –

One of the devices in network 1 (i.e. is connected directly to the internet. This device has 2 interfaces, hence it has 2 ip address, one facing off to the internet (, and the other to network 1 (

Therefore if any other machines in network-1 wants to send out data to the internet, then it has to do so via Hence all other network-1 devices needs to be configured so that it’s default gateway setting is set to The default gateway device then forwards the data on.

However for network-2, there are no devices that are connected directly to the internet. However one device,, is a device that is a member of both networks. One interface is facing off to network1 and the other to network2.

Therefore it is possible of a network-2 device to indirectly send data to the internet via, which in turn forwards it to

In order for this to work, the default gateway for should be set to

Note, there is a rule, which is that the default gateway ip address must be in the same ip range as all the other devices in the network.

Now what if wants to forward data to In this case, it has be done Hence for this to be possible, we need to set up a second “route” whereby if the target ip address is in the network2 range, then it will forward the data to rather than the default gateway (

You can temporarily add this route using the “ip” command. First we check the current routing info

$ ip route show
default via dev enp0s3  proto static  metric 100 dev enp0s3  proto kernel  scope link  src  metric 100

Now we add the new route:

$ ip route add via

Note, the above doesn’t give any outputs.

Now to check this has worked we do:

$ ip route show
default via dev enp0s3  proto static  metric 100 via dev enp0s3 dev enp0s3  proto kernel  scope link  src  metric 100

However for the rhcsa exam, you are only required to know how to change the default gateway. Which you can simply do by editing the relevant network-scripts.

Domain Name Servers (DNS)

These are servers that just contains a list of friendly machine fqdn/hostnames and what ip-number they are mapped to. Once again you can specify what your dns server is in your network-scripts.

A domain server can reside anywhere, i.e. inside a local network or outside on the internet.

Also see:

A machine can be part of more than one network. e.g. eth0 interface can be linked to LAN A, whereas eth1 can be connected to “LAN B”. In these scenarios, the machine needs to know which network outgoing traffic needs to be sent to. By definition, LAN A and B will have different IP ranges, and as a result, you can specify which interface to use for a given range of IP addresses.


This routing table contains several columns, column 1 (destinations) indicates the IP range, and column 3 (Genmask) helps to define that range more accurately.


If column 1, contains the entry “default” (which also would mean that the “G” flag is enabled), then it means that it is the default gateway.


If the IP falls outside the LAN A and B range, then you could specify the routing for the default gateway, and all out-of-range outbound traffic will be sent to that destination. This tends to be the router’s ip address, this is how it is done:

In the routing table, wherever there is an asterisk, it means that data is being redirected within the LAN.

Must survive reboot:

ifdown {interface name} boot # switches off an interface and ensures that it doesn’t come back on during reboot.

ifup {interface name}     boot # brings interface back up again (i.e. connects interface to internet). And ensures it

# automatically connects again after a reboot.

Book ref:

page 38, chapter 3 – good technique on how to use ping effectively.

page 40, chapter 3 – this list the various ifconfig options.

Study guide ref:


Need to learn more about:

arp command – bottom of page 40, chapter 3. I think this associates an IP address to a mac address. – this explain what the “RX” and “TX” values means in the ifconfig data.