Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new homepage at neilpahl.com.

Ubuntu Server - Static IP Address

Tags:  Ubuntu   
Created on Fri, 25 Nov 2011.
Last Modified on Wed, 04 Apr 2012.

Motivation Behind This Cheatsheet

I needed to know how to configure my Ubuntu Linux server (10.04 LTS) to have a static IP

The Cheatsheet

open the /etc/network/interfaces file and change

auto eth0
iface eth0 inet dhcp

to:

auto eth0
iface eth0 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

(the value after address can be set to your chosen IP)

Then open the /etc/resolv.conf file and change:

name server xxx.xxx.xxx.xxx

to the IP of your name server. (do ifconfig /all to find out what they are). Then, Remove the dhcp client:

sudo apt-get remove dhcp-client

and restart the networking components

sudo /etc/init.d/networking restart

ping something to check your connection.

Further Discussion

Although I used this for my Ubuntu Server (10.04 LTS), this method will probably work for non server edition and maybe other linux distros. Other Linux distros could very well have their configuration files in different locations.

Sources:

http://www.howtogeek.com/howto/ubuntu/change-ubuntu-server-from-dhcp-to-a-static-ip-address/


PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus