[HowTo] Change Ubuntu IP Address from DHCP to Static

For those who are new to Ubuntu or Debian, default setting of your network card is using DHCP. And in some case you want to use static IP, maybe for bypass some filter or your DHCP server is not working properly then you cannot connect to the network unless your network administrator come and fix it. In that situation you really need to change your network configuration from dhcp to static ip.

To change your network configuration from dhcp to static ip is not hard. You can follow these steps below:

  1. Open your terminal client
  2. Type this command:
    sudo vim /etc/network/interfaces
  3. Then you will see there are 2 network interface, lo and eth0. See example below:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet dhcp
  4. Change the eth0 one according to your network setting (you can call your network administrator and tell you the setting) , see example below
    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
  5. Save that file and close
  6. Restart your network to apply the new setting, with this command:
    /etc/init.d/networking restart
  7. See your network configuration by type:
    ifconfig

That’s it. Thanks for reading this article. Please leave any comment if you have another tips or input.

Comments

  1. wes says:

    What do you do about configuring DNS,… and WINS if you use Samba.

  2. Ab says:

    G'day Wes, DNS is in /etc/resolve.conf. RE WINS, depends if you want to setup a client or server. Both of which are well documented in the SAMBA docs.

  3. Cplatt123 says:

    thanks a lot you fixed my problem

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.