Friday, 22 February 2013

Homeserver - Assigning a static IP address

Its a good idea when setting up a home server that you use a static IP. That way its guaranteed to get the same IP every time meaning you will not have to make any configuration changes to your devices that point at the server. This post will show you how to set a static IP (I'm using Ubuntu 12.04 LTS server)

Disclaimer: I am not very good at unix/linux! I am not suggesting this is the best way to do it but this is the way I did it!

I followed the instruction on the Ubuntu help site (the version is old, but the instructions still work).

  • Open the interfaces file - sudo vi /etc/network/interfaces
  • Add an entry for your interface using the below example. "address" is the address you want your server to have, "gateway" is the IP address of your router.
auto eth0
iface eth0 inet static

  • Activate the interface - sudo ifup eth0
  • You now have to assign a nameserver (DNS) - sudo vi /etc/resolv.conf
  • Add a nameserver(s) - e.g nameserver
If your resolv.conf has text up the top saying not to update by hand do the following steps
  • Open the following file - sudo vi /etc/resolvconf/resolv.conf.d/base
  • Add a nameserver(s) - e.g nameserver
  • Restart resolvconf  - sudo resolvconf -u
And that's it! Your server now has a static IP that is persistent across reboots.

No comments:

Post a Comment