Category Archives: Network

I found two ways to configure the /etc/resolv.conf file to prevent it to be overridden by the system.

  1. Edit the base file under the resolv.conf.d file
sudo vim /etc/resolvconf/resolv.conf.d/base

and then add the nameservers to the file:


lastly, update resolvconf:

sudo resolvconf -u

2. Install dnsmasq and edit /etc/dnsmasq.conf to add the nameservers you want.

sudo apt install dnsmasq
vim /etc/dnsmasq.conf

Then restart the network services:

sudo service dnsmasq restart and
sudo service network-manager restart

You should be all set now.





Static IP config with netplan (ubuntu)

If you use a modern Ubuntu distribution (the latest 18.04 LTS or 17.XX), you might have noticed that the package to configure the network changed.

Ubuntu changed to Netplan, that is more modern and relatively simpler to use. The file configuration for a static IP should be as follows.

# cat /etc/netplan/01-netcfg.yaml
 version: 2
 renderer: networkd
 dhcp4: no
 addresses: [YOUR.STATIC.IP.ADDRESS/24]
 gateway4: X.X.X.X
 addresses: [YY.YY.YY.YY,]

Reference: I extracted the following information from

Please visit the link above for more information (including the original /etc/network/interfaces format of the eth0 interface before the transition to netplan).


Find out your gateway IP address

There are two ways of collecting the IP address of your current Gateway:

  1. netstat -r
  2. route -n

The output of both commands are the almost the same:

12:29:25 ✔ dbkreling:~$ sudo netstat -r
[sudo] password for dbkreling:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         UG        0 0          0 wlan0      *          U         0 0          0 docker0     *        U         0 0          0 wlan0

12:29:36 ✔ dbkreling:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 wlan0     U     0      0        0 docker0   U     9      0        0 wlan0

In my case above IP is the gateway for my connection. The flag U indicates that route is up and G indicates that it is gateway.