So as you may have already found, things work slightly differently with the new Jessie based Debian OS. If you have hit my last Static IP post and thought things were just not quite right, this ones for you!
It seems that
/etc/network/interfaces is overruled by
dhcpcd meaning your soon to be static ip has to be set elsewhere.
/etc/network/interfaces file, your specific interface (
iface) should be left as
manual. In fact, if you are working with a fresh install the easiest way is just not to touch it at all! If curiosity gets the better of you, there is also a statement in there telling you to look elsewhere to change the settings.
Extract from /etc/network/interfaces # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
We do still have to know a few things so if you need a recap have a read of my last post on the subject and gather the info you need.
Particularly we are looking for the following
Obviously the IP address you want to set, provided it is within bounds is totally up to you.
/etc/dhcpcd.conf with your favourite text editor
Fairly simple… We are going to add 3 lines to the bottom
static ip_address=192.168.1.199/24 static routers=192.168.1.1 static domain_name_servers=127.0.0.1 // In my case i am running a caching nameserver on localhost // - Hence the directive of 127.0.0.1 for the nameserver. // In most cases nameserver will be the same address as your gateway
I hear you thinking “What is the
/24 on the tail of the IP address?”
– Well i am going to say “Google It!”
In this case it is shorthand for
255.255.255.0 with a broadcast of
broadcast is different, be careful… It may help to use a calculator to determine the leading count.
I feel the rest speaks for itself.
Save the file & restart networking or reboot.
Confirm we are good by running
ifconfig route -n cat /etc/resolv.conf //In most cases your gateway address