Linux Basics - Static IP and Network Configuration on Debian Linux
This guide explains how to configure static IP address, dns configuration and hostname on debian based Linux distributions on the shell. Suppose you are working in a data center or company and your boss puts a dumb debian server setup and you need to configure it in the running environment. Yes it is little painstaking, but not very tough task. In my case I have a dumb debian server which was installed by someone in his networking environment and I want to make it functional in my static IP environment. Suppose I have a vacant IP IPv4 IP 192.168.0.100subnet 255.255.255.0gateway 192.168.0.1 IPv6 address 2001:db8::c0ca:1eafnetmask 64gateway 2001:db8::1ead:ed:beef DNS 126.96.36.199.8.4.4 All the above values will be fitted as per your environment. The DNS Servers 188.8.131.52 and 184.108.40.206 are free public DNS servers from Google, you may use them on your server for free. I will use the editor nano in the examples Use your preferred text editor to edit the configuration files (e.g. If you use "nano" editor, type Ctrl x to save changes. I will do manual configuration with root credentials of the network config file, which is the responsible for the IP information in my debian system. The file name is Now the value must be same for both cases hostnamehostname -f I am using Debian Linux and I would like to create alias for eth0 so that I can have multiple IP address. I will implemented by appending it as follows: nano /etc/network/interfaces Note: There will be no extra column for the Gateway. Here I have done the IP aliasing for the IP 192.168.0.108, it could vary as per your requirement. After any change in the networking files you need to restart the network services as follows: service networking restart On Debian 7, use the following command instead: /etc/init.d/networking restart After the service restart you can check the changes as: ifconfig The output will confirm the changes done statically. If you are running a larger static IP net, it's far better to deploy a DHCP server and define all static addresses there using "host" statements instead of locally per new machine. I use the isc-dhcp-server available in the Debian repo. There are just two configuration files: /etc/dhcp//etc/dhcp/And there is plenty of documentation about how these two work.
What is DHCP and how to configure DHCP server in Linux.
Appendix. Ubuntu client network settings to use DHCP. To configure your client to use a DHCP on a network interface eth0 on Ubuntu or Debian linux systems enter a following lines in your /etc/network/interfaces file auto eth0 iface eth0 inet dhcp.
Chapter 5. Network setup - Debian
These automatic network configuration tools may not be compatible with esoteric configurations of legacy ifupdown in " /etc/network/interfaces " such as ones in Section 5.5, “The basic network configuration with. Add an option line with " metric 0 " just below the " iface eth0 inet dhcp " line in " /etc/network/interfaces ".