Tip: Setting up static IP in debian
Posted: Sat May 07, 2005 1:15 pm
When I find out something hard to find in linux figured I'll start posting it here for my own reference later, and for everyone else's as well.
To configure a static IP (an IP that will never change) in debian you must edit the file
/etc/networking/interfaces and put the following:
To configure a static IP (an IP that will never change) in debian you must edit the file
/etc/networking/interfaces and put the following:
Code: Select all
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
[code]
The last section is the most important, the top may or may not be the same so don't play with it unless you get an error. In this case the IP of the server is 192.168.1.10 so if you run it as a DNS server for example, you can set that in your router's config and not worry about it changing.
To apply this configuration type /etc/init.d/networking restart
You'll get a message that it's restarting the network interface, then you'll get booted off ssh (because the IP changed) so reconnect using the new IP and it should work.
In red hat this file is /etc/sysconfig/network-scripts/ifcfg-eth0 and you would put this in it:
[code]
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:3298, old post ID:26748[/size][/color]