7

I want my private IP address 192.168.xxx.xxx to be fixed and do not change, Is it possible? I am using Ubuntu 14.04. I need it to work even when I change the network? Thank's

3 Answers3

5

Yes it is possible to static your IP

The following steps describes how to configure static IP address on Ubuntu 14.04.

You need to edit the file /etc/network/interfaces.

I have used gedit as an editor. If you don't have it installed you can replace it with vim or whichever you have.

sudo  gedit /etc/network/interfaces

Then change to include the following:

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
#iface lo inet interface
iface eth0 inet static
address 192.168.1.122
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
~

eth0 is the regular ethernet interface
address is the static IP address you choose
gateway is usually the router's IP address
dns-nameservers is the dns server IP address, this is needed for domain name resolution

After the change you can either reboot or run

sudo ifdown eth0

sudo  ifup  eth0

Check now. Run terminal and type:

ifconfig
4

In the dash search for "Network Connections" and open the application, from here select the interface you want and click on the edit button:

Network Settings

From here click on the IPv4 Settings tab and change the method from Automatic DHCP to Manual and enter your network setting to something like this:

Network Settings 2

Now all you need to do is save the settings and restart the network connection and the ip should be statically set.

Please bare in mind that these settings are specific to Ubuntu and if, for example another device on the network connects using your static IP through DHCP you won't be able to connect using your static IP because it would have already been assigned.

Michael Lindman
  • 1,742
  • 2
  • 17
  • 23
  • But I don't have lan so I will choose a speccific wifi connection but I need it to be static even for other future wifi connections – Lola Loulita May 22 '15 at 11:44
  • The only way to make your connection truly static would be by using DHCP Reservation on your router to statically set the same IP address to the network card on your computer using its MAC address but that is out of scope on Ask Ubuntu because it is related to networking hardware/software and not Ubuntu directly. – Michael Lindman May 22 '15 at 11:49
  • @LolaLoulita That won't work on Wireless if you have multiple wifi networks you use. To do that you have to tell the system to NOT let NetworkManager handle the network connection, and have the standard /etc/network/interfaces file determine addressing as well as using command line tools to manage the wireless connection. Static IP and Wifi also do not go well together. – Thomas Ward May 22 '15 at 12:11
-3

You can set it from your box.

Just connect to it as an administrator and look for advanced options.

There should be a way to ask your box to give your computer always the same IP address.

jeremielc
  • 615