Configure a static IP in Debian 5 Lenny

Edit the file /etc/network/interfaces

At first it will look something like this:


# /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 dhcp


Update the file to change eth0 from dhcp to static, like so:


# /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


The following guidelines will work for those that don’t know any better. If you do know better, awesome!

  • You would basically replace the 192.168.1.10 with the static IP address you want to use.
  • Always use 255.255.255.0 for the netmask.
  • The network should be your static IP with a zero in place of the last number.
  • The broadcast should be your static IP with 255 in place of the last number.
  • The gateway should be your static IP with 1 in place of the last number.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>