Help - Search - Members - Calendar
Full Version: How To Set Static Ip On Linux?
Linuxhelp > Support > Technical Support
I have several computers on my LAN, and would like each to have the same IP every time they start up.

How could I do this? Thanks!
It depends on your distro ....

I know you use mostly debian ... and I assume you have a DHCP server and and internal IPs (10.x.x.x or 192.168.x.x).

I don't know what you are doing for the DHCP server ... but on DHCP servers, you can assign a reservation for a specific MAC address to get a specific IP address...that is one way. Here is an easier one:

In the device that controllers the IP addresses, make sure to block off a range that doesn't get assigned ... for example, if you are using the network, is probably your gateway ... set the dhcp range that the server will give to something like -

Now you can make static assignments from - .... and > ... but the system can still assign from to to PCs using dhcp.

Make sure you exclude the static assignments from the dhcp server (as discussed in the above 2 paragraphs), otherwise if you leave any PC on DHCP, it could get assigned an address that duplicates your static address.

Now to make a static assignment (in debian), edit the file /etc/network/interfaces and remark out (put a # in front of it) the line:

iface eth0 inet dhcp

so it becomes this:

#iface eth0 inet dhcp

The add a lines like this at the bottom of the file:
iface eth0 inet static

(substitute the address you want for ... and the gateway)
In whitebox, you can use the command:

Thank you very much for answering all my questions. happy.gif
your welcome biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.