Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

[Solved] Raspbian Stretch: Setting a static IP

Fri Aug 18, 2017 8:26 pm

Hello everyone,

I recently aquired a Pi3 and now set it up with the new stretch image. I need to assign it a static IP, but none of the ways the internet has told me has worked. It always either was not reachable from outside or couldn't even reach Google (8.8.8.8).
Is there a reliable way to tell the pi to have a static IP?
BTW, my router doesn't support that so I have to do it from the pi.
Thanks in advance for any help.
Last edited by Robbi_Blechdose on Sat Aug 19, 2017 9:02 am, edited 1 time in total.

pcmanbob
Posts: 6675
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Raspbian Stretch: Setting a static IP

Fri Aug 18, 2017 9:08 pm

Hi.

Setting a static IP in stretch has changed because the eth0 is replace by the new enx format.

so first find what your eth0 is now called by doing

Code: Select all

 ifconfig 
this is mine

Code: Select all

enxb827ebdc0d1f: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.15  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::1712:8263:d0d9:c187  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:dc:0d:1f  txqueuelen 1000  (Ethernet)
        RX packets 400  bytes 41204 (40.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 273  bytes 55706 (54.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:89:58:4a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
so you can see eth0 is now enxb827ebdc0d1f in my case
and the my ip is 192.168.1.15 which my static IP I set.

so edit dhcpcd.conf with

Code: Select all

 sudo nano /etc/dhcpcd.conf 
so you add your static ip settings to the end if the file like this

Code: Select all

 
#static IP configuration

interface enxb827ebdc0d1f
static ip_address=192.168.1.15/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
using the new name for eth0.

hope this helps.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 7:23 am

Thanks for the help,
but (I should have clarified that) I'd like to set it for wlan0 as I'm using the Pi3's wifi.

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 7:27 am

Robbi_Blechdose wrote:
Sat Aug 19, 2017 7:23 am
Thanks for the help,
but (I should have clarified that) I'd like to set it for wlan0 as I'm using the Pi3's wifi.
Change the interface name to 'wlan0'

Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 7:36 am

I already tried that approach, and it completely shot the networking on the pi until I changed the config back.
Are you sure that that is the correct way?

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 7:44 am

Did you make changes to other network related files, like /etc/network/interfaces?

BTW: if you use Raspbian desktop version then you should be able to set the static IP from the panel applet.

Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 8:11 am

Nope, didn't do any other changes. Fresh install.
And even the applet breaks everything. :cry:

EDIT: Just looked at the sticky wifi topic, might help saying that these lines are missing in /etc/network/interfaces:
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

pcmanbob
Posts: 6675
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 8:20 am

Networking seems to have been totally messed up in stretch, so much so I don't plan to use it for anything in the near future until its been sorted.
As others have noted even putting fix in place to return to old port identifications messes up the wan port naming/visability.

can't comment on setting static IP on Wi-Fi as I don't use it on my pi's since I moved to Jessie, the only pi I have using Wi-Fi is on my rover and that's still running wheezy.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 8:28 am

So I'll probably switch back to Jessie where the networking works properly. Thanks for the help anyway.
EDIT: It appears that Strech fixed an exploit in the wifi chip, so Jessie is not an option. :|

Robbi_Blechdose
Posts: 83
Joined: Sat Sep 20, 2014 6:11 pm

Re: Raspbian Stretch: Setting a static IP

Sat Aug 19, 2017 9:01 am

Managed to fix it: I was giving it an xxx.xxx.10.xxx IP when all other IPs are xxx.xxx.2.xxx. It's now working.


Carlos G.
Posts: 1
Joined: Fri Sep 08, 2017 2:46 pm

Re: Raspbian Stretch: Setting a static IP

Fri Sep 08, 2017 2:52 pm

pcmanbob wrote:
Fri Aug 18, 2017 9:08 pm

so edit dhcpcd.conf with

Code: Select all

 sudo nano /etc/dhcpcd.conf 
so you add your static ip settings to the end if the file like this

Code: Select all

 
#static IP configuration

interface enxb827ebdc0d1f
static ip_address=192.168.1.15/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
Hi,
I've made the recommended changes to the dhcpd.conf file and it still reboots on DHCP (the file is saved and I'm using my adaptor's ID in enx format)
Am I missing any further step?

Using Raspbian Stretch as of Sep 6, 2017.

Thank you.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Fri Sep 08, 2017 4:09 pm

If that is the interface name you used for your ethernet interface, it probably won't work. That is pcmanbob's interface name. You must get YOUR ethernet interface name. You can find your interface name with ifconfig.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: [Solved] Raspbian Stretch: Setting a static IP

Fri Sep 08, 2017 4:22 pm

You can find your interface name with ifconfig.
And this is progress???
If this post appears in the wrong forums category, my apologies.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Fri Sep 08, 2017 4:43 pm

Martin Frezman wrote:
You can find your interface name with ifconfig.
And this is progress???
I don't know. I'm flexible and can deal with it.

pcmanbob
Posts: 6675
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 10:08 am

Martin Frezman wrote:
Fri Sep 08, 2017 4:22 pm
You can find your interface name with ifconfig.
And this is progress???
I agree with you making such a change of a device designed for educational / beginner use was in my opinion a bad move it probably broke many how tos and ready made scripts.
But as has already been stated on the forum in several threads the next release/update of stretch will revert to the old naming.

I believe the next release is available now but I have not checked it yet.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 10:59 am

pcmanbob wrote:
Sat Sep 09, 2017 10:08 am
I believe the next release is available now but I have not checked it yet.
Yes, it's the 2017-09-07 image

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 11:25 am

Is this going to require more than an update and upgrade? I just did that and the funny interface names are still there.

pcmanbob
Posts: 6675
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 11:31 am

SurferTim wrote:
Sat Sep 09, 2017 11:25 am
Is this going to require more than an update and upgrade? I just did that and the funny interface names are still there.
updating from Jessie to stretch did not change to the new interface naming only a fresh install made the change, so I suspect to revert to the old interface naming you will need a fresh install of stretch.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 11:35 am

I have a spare SD card. I'll give it a try.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 11:40 am

pcmanbob wrote:
Sat Sep 09, 2017 11:31 am
SurferTim wrote:
Sat Sep 09, 2017 11:25 am
Is this going to require more than an update and upgrade? I just did that and the funny interface names are still there.
updating from Jessie to stretch did not change to the new interface naming only a fresh install made the change, so I suspect to revert to the old interface naming you will need a fresh install of stretch.
Or you just fix it yourself. The "net.ifnames=0" method is the most obvious.
If this post appears in the wrong forums category, my apologies.

User avatar
rpdom
Posts: 15014
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 12:00 pm

The latest Stretch image has the weird net names thing disabled. I booted up a Pi 3B with Stretch Lite 07/09/2017 today and it had eth0 as the main interface.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Sep 09, 2017 1:10 pm

I booted 2017-09-07-Stretch/Pixel and the interfaces have the familiar names (eth0, wlan0).

Not only that, it appears to have corrected the wlan0/wlan1 problem I had. The usb wifi was coming up as wlan0 on boot. Now it comes up as wlan1. I set up my two wifi devices (one as an AP, the other as a client that provides internet access), and it works now.

bhong2002
Posts: 1
Joined: Tue Oct 02, 2012 4:34 pm

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Oct 14, 2017 7:27 am

how about i dont have usb lan?,, i just want to use wlan0 as static ip(hostapd, dnsmasq)?

having a problem on dnsmasq .. "unknown interface wlan0"

thanks

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [Solved] Raspbian Stretch: Setting a static IP

Sat Oct 14, 2017 10:04 am

@bhong2002: Post the output of ifconfig. Are you trying to set up an access point?

Return to “Troubleshooting”