Comments on Linux Basics - Static IP and Network Configuration on Debian Linux
Linux Basics - Static IP and Network Configuration in Debian Linux This guide explains how to configure static IP address, dns configuration and hostname on debian based Linux distributions on the shell. It will be same in server & desktop. 1 Preliminary Note 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 192.168.0.100 and I will implement it in my environment. My IP details are as follows:
8 Comment(s)
Comments
While what you have is a good start for a simple two or three node network... 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. It's incredibly easy to run. There are just two configuration files:
/etc/dhcp/dhcpd.conf
/etc/dhcp/dhclient.conf
And there is plenty of documentation about how these two work. But here's a very basic dhcp.conf that includes a dynamic pool as well as a single static host...
subnet 192.168.25.160 netmask 255.255.255.240 {
pool {range 192.168.25.161 192.168.25.174; }
}
host workstation1 {
hardware ethernet a4:6b:14:5e:4c:8a;
fixed-address 192.168.2.45;
}
Of course, if you need to have pool addresses "talk" directly to static addresses, you can leave everything in one big class C --- which just changes the first line to:
subnet 192.168.25.0 netmask 255.255.255.0 {
A few of the big advantages to deploying a dhcp server for a static network is the ability to not worry about local settings at all. You only need to define the nameservers a single time in the dhcp server... and subnetting is much easier to keep track of...
That's on the address side - things on the DNS side are a lot more tricky... and I would stick with adding host names manually or not at all. If you really do need local network host name lookup and the network is more than 5 or six hosts, you're probably better off installing a local only DNS. It's important to point out that in order for manually defined host entries to work - every node needs to include definitions for every other node. This gets very tedious and error prone after just a few hosts.
On a beaglebone black rev C (Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09
UTC 2014 armv7l GNU/Linux)
I had to add auto eth0 to get the static ip address to work, thus:
# IPv4 address
auto eth0
iface eth0 inet static
address 192.168.1.90
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.0.255
gateway 192.168.1.1
FYI, Debian 7.x is reporting the following as deprecated;
/etc/init.d/networking restart
i tried to change my ip adress but i got some problems it's not working any more and i made a backup before i have started as you said in the beiganing "mv /etc/network/interfaces /etc/network/interfaces.bak" now i want to return it back how i can do that ??
VERY GOOD (clean, crisp, error-free, and LOGICAL and COMPLETE) ... good work. Also the comment from 'Anonymous' is also valid and useful. But your article is what it says "... from command line"
thank you
pm
In step 2 eth0 is not auto loaded
auto loiface lo inet loopback#My IP description# IPv4 addressiface 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
This is all fairly straight forward when done in a script at boot time. However, I am building installations where my user will need to configure the IP address and set it to static. Is ther a way to do this from the command line? I figure I'll integrate that command into a small web page and let the user change the settings from there.
simply reverse the order:
mv /etc/network/interfaces.bak /etc/network/interfaces