Archive for the ‘Static IP’ Tag

COMMAND LINE ADVENTURES: Debian Lenny Static IP Address

Debian 5 (Lenny)
Linux kernel: 2.6.26-2-486

Back to my Debian Lenny Base install. I will mostly be accessing this box via ssh, so it needs a static ip address. How the hell do I do that? This box has no GUI. After a few days of searching the inter-webs, I wrote down what I thought I needed to do. I did all of this via ssh, all except the reboot part that is. This is what happened.

I just want to see what my ip address is now:
$ sudo ifconfig
Nice! I’ll use it. 192.168.1.68

The file you need is located at
etc/network/interfaces.

Alright, lets open that file:
$ sudo nano etc/network/interfaces

You should be looking at something like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

Now I changed mine to look like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.68
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Made the changes and saved.
I’m still not sure what a few of these address’s are. The network and broadcast address’s. I lined them up the best I could compairing my files with other examples on the net….and it worked. I saw on a few sites that you can apply these without rebooting with this command:
$ sudo etc/init.d/networking restart
It didn’t work for me. I had to reboot the machine. Everything came back up fine with the correct assigned ip address.
Have fun! Damn it!