Setting up Networking in Linux without Network Manager

Yesterday, I faced this issue in Ubuntu where I accidentally uninstalled DHCP client on my system and leading to it uninstalling the Network manager too! Doing an apt-get update returned

Err http://us.archive.ubuntu.com trusty Release.gpg
  Could not resolve 'us.archive.ubuntu.com'

And going to Settings -> Network returned “The system network services are not compatible with this version”. So to install the network manager back, I needed Internet. Circular dependency.

Sounds painful, but digging for a couple of hours, I was able to fix the issue. Two major problems here, need to manually make your internet work, and second, have a DNS server added that can be used. I used Ethernet because it’s easier to set up, but doing the same thing with Wifi shouldn’t be really hard.

 

1- Know what your ethernet interface is. Type

ifconfig -a

Mine turned out to be eth2

2- Set up your interface with a static IP address. The IP address that you take should be in the range that your router supports. The easiest way to get access to it is to use the settings from a device that is on your router already. Update the details in /etc/network/interfaces as(the IP address is 192.168.1.100, make sure no other device is using that already).

auto eth2
iface eth2 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1

4- Check if you have correct DNS server in your /etc/resolv.conf. If there is nothing apart from 127.0.0.1, you’ll need to add a DNS server to make things work. As specified in the resolv.conf file, you shouldn’t directly edit the file. Rather add the DNS servername in /etc/resolvconf/resolv.conf.d/base:

nameserver 8.8.8.8

That’s Google’s DNS server, and should be sufficient to get set and working in most cases.

5- Restart network components using

sudo /etc/init.d/networking restart

and make your network connection up using

ifconfig eth2 up

But that didn’t work for me but a restart did. You can check using ifconfig that your settings are reflected.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s