Pages

Thursday, November 10, 2011

Changing IP Address in Ubuntu 12.04

The situation is that you had a dynamic IP address and now want to set a static IP address, maybe because you're going to use the computer as a webserver.

You will need to first figure out your "gateway" and "netmask," while being connected to the internet with the dynamic IP address.

Gateway - Open a terminal and type:
# sudo route
The current gateway should appear under default. Write it down.

Netmask - Open a terminal and type:
# ifconfig
Where it says "mask" is the netmask.

Now, click on the network icon and "edit connections"
Enter a name for the connection, click set IPv4 to "manual," click "add," enter the information, then click "save."

Attempt to connect with your new settings, and it will say "connected" even though you cannot access the internet.
So, to finish, type in the terminal
# sudo dhclient
which enables internet connectivity.