When you got a server it’s actually kinda nice to know the address always stays the same 🙂 It’s actually not that hard to configure… when you know what to change of course, so here goes… I’m using vim as a text editor, but you should use the one you feel most comfortable with. Lets open the network interface configuration file.
sudo vim /etc/network/interfaces
Normally you got eth0 (I got enp3s0 on mine though) as your primary network interface and you should see something like this:
auto eth0 iface eth0 inet dhcp
Lets remove those lines and replace them with the following: (you should of course use your own values)
auto eth0 iface eth0 inet static address 192.168.1.31 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8
Now we need to change the DNS settings in the resolv.config file.
sudo vim /etc/resolv.conf
add the line
nameserver 8.8.8.8
Now you only have to restart the networking components:
sudo /etc/init.d/networking restart
There you go, just ping google.com and you should get a response if you put in the correct information. Cheers /jima