Interface config in Debian Linux

By donmc, 19 June, 2010
Topic

Configuring DHCP address for your network card

If you want to configure DHCP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

sudo vi /etc/network/interfaces
# The primary network interface: DHCP address assignment
auto eth0
iface eth0 inet dhcp

Configuring Static IP address for your network card

If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

sudo vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.88.8
gateway 192.168.88.1
netmask 255.255.255.0
network 192.168.88.0
broadcast 192.168.88.255

After entering all the details you need to restart networking services using the following command

sudo /etc/init.d/networking restart

Secondary IP addresses or Virtual IP address in Ubuntu/Debian Linux

Sometimes it is useful to have a secondary IP address on Ubuntu. To do this at the command line, you need to edit /etc/network/interfaces file and add the following entries:

sudo vi /etc/network/interfaces
auto eth0:1
iface eth0:1 inet static
address 192.168.77.7
netmask 255.255.255.0
network 192.168.77.0
broadcast 192.168.77.255
gateway 192.168.77.1