LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Static IP (https://www.linuxquestions.org/questions/linux-newbie-8/static-ip-273923/)

Stormfront 01-04-2005 07:27 PM

Static IP
 
How do I change my Linux box from DHCP to a static IP? I'm useing Debian with KDE. :)

:newbie:

comprookie2000 01-04-2005 07:32 PM

I just went through this,how do you connect?What distro?What isp?Give us the numbers you have like;
Code:

ifconfig_eth0=( "192.168.1.97 netmask 255.255.255.0 broadcast 255.255.255.255" )
routes_eth0=( "default gw 192.168.1.254" )


JimBass 01-04-2005 10:15 PM

What you're asking is very easy to do. The file that you need to edit is /etc/network/interfaces.

If you're currently set to accept a DHCP address, you should change the line that reads
Code:

iface eth0 inet dhcp
to read
Code:

iface eth0 inet static
and then add any of these lines as appropriate to your system:

Code:

address X.X.X.X
netmask Y.Y.Y.Y
network Z.Z.Z.Z
broadcast A.A.A.A
gateway B.B.B.B

If it is an internal network, and all you need is an IP, then I think you can get away with just an address. Most times you will need at least an address, gateway, and subnet to get out on the internet. The network and broadcast ear easy to figure out, they are usually the lowest and highest addresses in your subnet.

Once all that is changed to how you like it, do
Code:

ifdown eth0
and then follow with
Code:

ifup eth0
and you'll have the new address activated.


Peace,
JimBass

Stormfront 01-05-2005 04:48 PM

Very helpful. Works great. Thanks alot :D


All times are GMT -5. The time now is 10:47 PM.