Network Configuration

Manually configure network in Debian

If you are manually setting a static IP address in Debian, you have to edit /etc/network/interfaces. For example, if you want to change your eth0 interface to use a static IP address instead of dynamic IP address , change the following settings accordingly.

#iface eth0 inet dhcp #Comment this line out with the pound(#) key. It was your dhcp setting(dynamic IP address).
 
# Add the following lines below in /etc/network/interfaces.
# Add the 'auto' line below. Otherwise, at reboot eth0 interface will not be up. You have to manually run ifup eth0.
auto eth0
# Set eth0 interface to use static IP address
iface eth0 inet static
    # Enter your static IP address for eth0 interface.
    address 192.168.0.111
    netmask 255.255.255.0
    # Enter the IP address of your gateway(router).
    gateway 192.168.0.1

Make sure that the nameserver in /etc/resolv.conf as follows:

nameserver 192.168.0.1

Then, run the following for the changes to take effects:

/etc/init.d/networking restart
ifdown eth0
ifup eth0

References

Debian's network configuration manual

/etc/resolv.conf - your name servers go in there /etc/hostname - hostname for your box /etc/hosts http://www.linuxforums.org/forum/linux-newbie/506-setting-static-ip.html

#!/usr/bin/sh
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up #computer
route add -net 192.168.1.0 netmask 255.255.255.0 eth0 #network
route add default gw 192.168.1.1 eth0 #router/gateway