Home > Unix
Assigning IP address to an interface
If you need to add a static IP address that remains after boot you can add it by modifying (NOTE: this is used as the config file for the ifup and ifdown scripts)
/etc/network/interfaces
auto = Start on boot
inet static = staticly entered address
inet dhcp = Use DHCP query to assign network info
# The loopback interface
auto lo
iface lo inet loopback
# Static interface configuration
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# Automatic interface setup
auto eth1
iface eth1 inet static
auto lo
iface lo inet loopback
# Static interface configuration
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# Automatic interface setup
auto eth1
iface eth1 inet static
Once the file is configured restart the networking service.
/etc/init.d/networking restart
http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html#ASSIGNIP
