sjo102784
Posts: 4
Joined: Sat Apr 16, 2016 6:21 pm

Raspbian Jessie Static IP Config Issue

Mon Apr 18, 2016 2:37 pm

Hello:

I'm new to Jessie and have had a heck of a time setting a static IP address on my Raspberry Pi Jessie build. I'm using the latest build from the official Pi Foundation website, March 2016 version.

In the previous releases, I was able to set a static IP without fail by editing /etc/network/interfaces and entering my static IP information (address, broadcast, netmask, etc).

Upon upgrading to Jessie, this method no longer works. I've been through the Raspbian forums and other websites for assistance, but there doesn't seem to be a definitive solution to or process of setting up a static IP on Jessie. Many of the solutions I'm finding are reported to not work correctly in the threads themselves, and there seems to be a lot of misinformation out there about how to set a static IP on Jessie.

My understanding is this is the new way of setting a static IP in Jessie:
Edit "/etc/network/interfaces"
Change "iface eth0 inet manual"

Edit "/etc/dhcpcd.conf"
Set static IP by entering your settings at the bottom of the file:

"interface eth0
static ip_address=192.168.1.XXX
static routers=192.168.1.XXX
static domain_name_servers=192.168.1.XXX"

Save, reboot.

Problem is, I edited my files following this process this morning and it broke my network connectivity after a reboot.

Any ideas what is going on and/or what I'm missing? Thank you.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 12:08 am

I installed the same image today and the network issues drove me crazy, giving up for today.

I tried systemd-networkd too and that did not solve the problem: pings passed the router are hit and miss.

This installation is destined to be the dhcp server for my home lan.

And hopefully after upgrade to Stretch a samba active domain controller.

sjo102784
Posts: 4
Joined: Sat Apr 16, 2016 6:21 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 1:48 am

This is so dumb.

I tried probably six different methods of configuring my network settings using a variety of solutions from both these forums and other websites.

Before stating my solution, I want to say that this change - to use /etc/dhcpcd.conf to configure network settings - is completely unnecessary. What a waste of HOURS AND HOURS of time with no solutions provided by the people who made the changes.

Had to perform a full reinstall and run through a full re-configuring of my Raspberry Pi server to get it to work.

After reinstalling Jessie, I modified nothing aside from the /etc/dhcpcd.conf file.

Adding the following to the bottom of the dhcpcd.conf file immediately set my IP to a static address:
static ip_address=192.168.1.14
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Obviously your config will vary depending on your network setup, but this fixed it for me. I've never been this frustrated with the official Raspberry Pi distros. Never. PLEASE for the sake of the community, when changes are made to the method of setting something as basic as a static IP address, PLEASE post a guide or at least some information on the forums or the Raspberry Pi website indicating what needs to be done.

The amount of misinformation and confusion on the forums and other websites was unbelievable, not even considering the number of affected people.

I really appreciate what the Raspberry Pi team has done for the community and continues to do, but these types of changes need to be communicated in a more effective way.

sjo102784
Posts: 4
Joined: Sat Apr 16, 2016 6:21 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:08 am

Update - static IP stopped working. After a reboot, I was no longer able to remotely hit my RPi by IP. After trying two known good network cables, the Pi is unable to get out to the internet. Angry IP Scan turns up nothing related to my Pi.

This is ridiculous. I'm rolling back to Wheezy to see if I'll have better luck. I changed literally zero network related properties prior to the failure. With Wheezy, I'm able to set a static IP and get out to the internet without issues.

User avatar
Milliways
Posts: 770
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:36 am

What is really dumb is setting a static IP address.
If you actually read the note in /etc/network/interfaces "# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'" it would work.

In fact the Foundation made a mistake in continuing to use /etc/network/interfaces which is for a different networking system (which you can still use if you want to - just disable dhcpcd).

The reason your change to /etc/dhcpcd.conf did not work is because you did not follow the instructions - specifically you entered an incomplete CIDR address.

See [How do I set up networking/WiFi/Static IP](http://raspberrypi.stackexchange.com/a/37921/8697) for a detailed explanation.
Last edited by Milliways on Tue Apr 19, 2016 6:07 am, edited 1 time in total.

klricks
Posts: 8198
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 4:20 am

IMO it is way easier to use the DCHP reservation to MAC address function in your router instead of fussing with static setup.
That way the router always gives the same IP, of your choice, but with no configuration changes on the RPi at all.
Note if using a RPi 3 then be sure to assign different IP's to the WIFI and wired.
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 5:51 am

klricks wrote:IMO it is way easier to use the DCHP reservation to MAC address function in your router instead of fussing with static setup.
That way the router always gives the same IP, of your choice, .
What if you want several IP addresses? When I looked at the source code some time back, the dhcp was hardcoded so you could only get one. This was ubuntu, as I recall, but the idea is the same. But how would you do this with your mechanism?

immauss
Posts: 4
Joined: Tue Apr 19, 2016 12:11 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 12:14 pm

And of course you are planning to use your pi as the dhcp server.

immauss
Posts: 4
Joined: Tue Apr 19, 2016 12:11 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 12:31 pm

You could also:

edit /etc/network/interfaces like so:

Code: Select all

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 172.16.101.11
    netmask 255.255.255.0
    gateway 172.16.101.1
auto eth0:0
iface eth0:0 inet static
    address 172.16.101.12
    netmask 255.255.255.0
    gateway 172.16.101.1

Then:

Code: Select all

pi@raspberrypi:~ $ sudo systemctl disable dhcpcd

Now you have two static IPs . ( and more free memory. )

klricks
Posts: 8198
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 12:38 pm

stderr wrote:
klricks wrote:IMO it is way easier to use the DCHP reservation to MAC address function in your router instead of fussing with static setup.
That way the router always gives the same IP, of your choice, .
What if you want several IP addresses? When I looked at the source code some time back, the dhcp was hardcoded so you could only get one. This was ubuntu, as I recall, but the idea is the same. But how would you do this with your mechanism?
Don't know how or why it would be useful to most users?
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

immauss
Posts: 4
Joined: Tue Apr 19, 2016 12:11 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 12:42 pm

In my case: core router/services/vpn server

Static IP, because I want the pi to be my dhcp server.

Multiple IPs, because I run multiple VPNs to different destinations. Each IP is a gateway for a different tunnel.

But then I do tend to over complicate things sometimes.

sjo102784
Posts: 4
Joined: Sat Apr 16, 2016 6:21 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 1:41 pm

Thanks for the responses from (mostly) everyone, I've bailed completely on Jessie.

The CIDR address issue didn't seem to present a problem for my network connectivity prior to the last reboot that resulted in it failing. After the network failure, I hooked it up directly to a monitor and tried adding /24 to the end of the IP address in the dhcpcd.conf file (which didn't work) and also attempted adding a /255.255.255.0 in place of the CIDR notation, which also did not work. I'm no network guru, but based on what I've read - that should have resolved the issue.

Also - I'm not sure why I need to explain the use of a static IP on a device (Raspberry Pi) that is easily used as a lightweight home server...but using a static IP isn't "dumb" in my opinion. I understand I could go through the process of DHCP reservations through my router, but from my perspective (at least using Wheezy) this process was much easier and more reliable, given that I've had a number of routers fail in the recent past. Having to enter five lines in a text file (if the Pi were to die) is much easier than having to reconfigure every single DHCP reservation along with the other router settings I'd have to rebuild should the router die. Also I enjoy tinkering with Raspbian, so learning the OS and how to tweak functionality isn't a big deal to me (aside from this issue with Jessie).

Anywho, if I weren't so frustrated, I would probably go back to Jessie to attempt some of the changes here. At this point I was able to rebuild the entire server from scratch using Wheezy in a quarter of the time I spent troubleshooting Jessie. I really appreciate the solutions that were presented - and I hope someone else finds them helpful when they (inevitably) run into this problem themselves.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:07 pm

Milliways wrote:The reason your change to /etc/dhcpcd.conf did not work is because you did not follow the instructions - specifically you entered an incomplete CIDR address.
My problem turned out to be different:
Since my AT&T router does not support disabling its DHCP service, I work around that by allocating a range of 2 (two) addresses, with MAC reservation.
One for the television and one for the Rpi2.

Then the Rpi2 serves all other addresses to all the other devices on the LAN, with my preferred DNS (required for Active Directory).

While I took the Rpi2 offline for reimaging my phone claimed the available IP address from the router and when I booted the Rpi2 and configured the static IP I got a conflict. After I took my phone offline the Rpi2 works fine on the LAN and I was able to upgrade to Stretch/Testing. This way I have Samba 4.3 available on the Rpi2 and that matches the Samba 4.3 on my file server.
Milliways wrote:What is really dumb is setting a static IP address.
Sir,
You don't know me and I don't you.
There is nothing dumb about setting a static IP address.
Thank you very much.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:12 pm

immauss wrote:And of course you are planning to use your pi as the dhcp server.
Yes,

The reason is that my AT&T router does not support custom DNS and my active directory on the LAN requires a custom DNS,.
When the Rpi2 features as DHCP on the LAN it can provide the custom DNS.

Sir,
Just because you don't understand my motivations that does not mean that I'm wrong.
Thank you very much.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:15 pm

klricks wrote:IMO it is way easier to use the DCHP reservation to MAC address function in your router instead of fussing with static setup.
I concur, but my AT&T router does not support custom DNS, which is required by my active directory.
So, I serve IP and DNS myself.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:21 pm

Wilbertvb wrote:Since my AT&T router does not support disabling its DHCP service,
That's really bad, I have 6 routers in my network right now and obviously if I couldn't shut off the DHCP on more than one of them, I'd be be potentially battling. I have a few routers that like to forget things including their passwords which makes it difficult in any case. I don't think any of those are online right now though. One thing I do is move the ip of the routers away from 192.168.1.1 or 0.1 because if I put another router in that I've had to reset, that's where it often will go. Of course the dhcp is turned on again....

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 3:40 pm

sjo102784 wrote:Thanks for the responses from (mostly) everyone, I've bailed completely on Jessie.
When I couldn't get Jessie to boot consistently, this was some time ago, I went back to Wheezy because I just wanted the systems to function. But I think by now that isn't an issue and even if the static stuff is irritating, might as well just deal with it.

Keep in mind that the next change, which you can see in Ubuntu 16.04, is consistent hardware names for the networking ports. I don't know if there's a way to assign "eth0" to one of these named ports so that older scripts just work and so that one can think about what the port logically is and not what it physically is, but right now the names directly are something like enp1s11. I've also got a test going where the enp1s11 port is set up dhcp and the enp1s11:static is set up statically. Actually, it's set up by a script using ifconfig but it acts as if setup statically via whatever means 16.04 feels like using. I would expect this sort of thing to be evolving into Debian and then into Raspbian over the span.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 7:17 pm

stderr wrote:I don't know if there's a way to assign "eth0" to one of these named ports so that older scripts just work and so that one can think about what the port logically is and not what it physically is, but right now the names directly are something like enp1s11.
After I discovered that my problem was caused by an IP address conflict, I solved my network problem, I uninstalled dhcpcd5 and enabled systemd-networkd.
in the script I avoid device names like eth0 or enp1s0 and rely on the MAC address.

Example of /etc/systemd/network/lan.network:

Code: Select all

[Match]
MACAddress=xx:xx:xx:xx:xx:xx

[Network]
Address=192.168.3.1/16
Gateway=192.168.1.254
DNS=8.8.8.8
DNS=8.8.4.4

immauss
Posts: 4
Joined: Tue Apr 19, 2016 12:11 pm

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 7:33 pm

@wilvertb ... I'm with you. My pi is my dhcp_server. ( and my DNS server, and my VPN server.) I found this thread looking for the same thing. Gave up. Dug deeper, looked at Debian configs, and built the config you see above. That's straight off my pi. I'm a RedHat guy myself, so sometimes it takes me a little longer to hack through a debian build. This was a little wonky to me. I can perfectly understand setting dhcp reservations and all that, I do it to. All of my fixed assets on my home network are dhcp reservations. Using ISC-dhcp-server. Some have different default routes that point to different VPNs. It's just easier to set the IP of say an Apple TV using the dhcp reservation. But my Pi, is the server. It has to have a static IP. I don't see the point in setting that up with a dhcp client locally. It just feels .... wrong. I personally feel the method I described above is a more reliable, efficient and more secure. One less unneeded daemon running is always better.

Wilbertvb
Posts: 6
Joined: Tue Apr 19, 2016 12:01 am

Re: Raspbian Jessie Static IP Config Issue

Tue Apr 19, 2016 11:56 pm

@Immauss, I discovered a while ago the benefits of Active Directory and when Sernet started to charge for Samba 4.3+ I was so frustrated. OpenSuse and Redhat offer 4.3 without AD-DC because of their Kerberos policy.

Just last week I found 4.3 available in Debian 9 and yesterday I found Debian 8 for Pi2. I could not wait to test if Debian 9 was available on Pi2 and today I finished with success: failover DHCP, 2 DNS servers and 2 AD-DC servers.

The Pi2 is the main server and performing really well. A second server is file and print server.

User avatar
Milliways
Posts: 770
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Raspbian Jessie Static IP Config Issue

Wed Apr 20, 2016 1:00 am

[quote="Wilbertvb"
Milliways wrote:What is really dumb is setting a static IP address.
Sir,
You don't know me and I don't you.
There is nothing dumb about setting a static IP address.
Thank you very much.[/quote]

That was prompted by the comment by the original questioner sjo102784 "This is so dumb."

peterlite
Posts: 722
Joined: Sun Apr 17, 2016 4:00 am

Re: Raspbian Jessie Static IP Config Issue

Sat Apr 30, 2016 2:51 am

dhcpcd created problems for me. isc-dhcp-server did not solve them. dnsmasq fixed everything. dnsmasq worked with dhcpcd without problems.

Leave dhcpcd in place. Put static addresses in dhcpcd.conf. Install dnsmasq to supply addresses everywhere. The only requirement was to place the static address in dhcpcd within the range in dnsmasq.

I am also replacing a router because the router does not have the range and will not let me add other services in the future. Go Pi! Go Jessie!

RikJoh
Posts: 1
Joined: Wed May 07, 2014 11:51 am

Re: Raspbian Jessie Static IP Config Issue

Mon Dec 12, 2016 4:04 am

Why not add a setting in the raspi-config?
Static/dhcp.
And make sure ssh really DOES enable!
Why else is there a choice, if it doesn't work?

User avatar
DougieLawson
Posts: 41966
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspbian Jessie Static IP Config Issue

Mon Dec 12, 2016 6:10 pm

RikJoh wrote:Why not add a setting in the raspi-config?
Static/dhcp.
And make sure ssh really DOES enable!
Why else is there a choice, if it doesn't work?
That would be too simple. Write the code yourself and do a pull request.

https://github.com/RPi-Distro/raspi-config
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Return to “Raspberry Pi OS”