PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

[SOLVED] Static IP Not Working Raspbian Buster Lite

Fri Jul 26, 2019 6:46 pm

Hello,

So, I am attempting to set a static IP address on my Raspberry Pi 3B+.

OS:
Raspbian 10 Buster Lite

My NodeJS script was working fine with a dynamic IP address. So I went into /etc/dhcpcd.conf and, at the end of the file added:

Code: Select all

interface eth0
static ip_address=192.168.1.55/20
static routers=192.168.1.1
static domain_name_servers=192.168.1.33 192.168.1.36

interface wlan0
static ip_address=192.168.1.55/20
static routers=192.168.1.1
static domain_name_servers=192.168.1.33 192.168.1.36

Then after I rebooted, when I run command sudo ifconfig, I receive:

Code: Select all

eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
            ether b8:27:eb:c1:c6:ed 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

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 1000 (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=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
	    inet 192.168.1.55 netmask 255.255.240.0 broadcast 192.168.15.255
	    inet6 fe80::8850:de90:bf3e:3bad prefixlen 64 scopeid 0x20<link>
	    ether b8:27:eb:94:93:b8 txqueuelen 1000 (Ethernet)
	    RX packets 135 bytes 14840 (14.4 KiB)
	    RX errors 0 dropped 0 overruns 0 frame 0
	    TX packets 24 bytes 3580 (3.4 KiB)
	    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Note, I am only using the WiFi (no Ethernet cable is plugged in). The NodeJS script is set to automatically run at boot.

Then, when I attempt an HTTP request, or attempt to SSH into the Pi (with the new IP address or the old), neither work.


Can anyone help me? I have no clue what is wrong here. The settings I added in at the top are correct. I'm really hoping someone can help me out here.


Thanks
Last edited by PureStress on Mon Aug 05, 2019 7:05 pm, edited 1 time in total.

Ernst
Posts: 1333
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Static IP Not Working Raspbian Buster Lite

Fri Jul 26, 2019 8:57 pm

You have three problems:
1) wrong subnet mask, 192.168.1.55/20 instead of /24
2) duplicate IP address, 192.168.1.55
3) two interfaces in the same subnet
The road to insanity is paved with static ip addresses

epoch1970
Posts: 5022
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Static IP Not Working Raspbian Buster Lite

Fri Jul 26, 2019 9:12 pm

Ernst wrote:
Fri Jul 26, 2019 8:57 pm
You have three problems:
1) wrong subnet mask, 192.168.1.55/20 instead of /24
2) duplicate IP address, 192.168.1.55
3) two interfaces in the same subnet
I think the OP has the 1st problem.
The 3rd one is not a problem, dhcpcd handles that with metric values by itself.
The 2nd one is tragically not a problem either, and you can find guides that recommend using the same IP for 2 interfaces. Systemd/dhcpcd work behind the scenes and actually disable one of the conflicting interfaces (or delete one of the addresses.) Try it, you won’t believe your eyes...
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 2:18 pm

epoch1970 wrote:
Ernst wrote:
Fri Jul 26, 2019 8:57 pm
You have three problems:
1) wrong subnet mask, 192.168.1.55/20 instead of /24
2) duplicate IP address, 192.168.1.55
3) two interfaces in the same subnet
I think the OP has the 1st problem.
The 3rd one is not a problem, dhcpcd handles that with metric values by itself.
The 2nd one is tragically not a problem either, and you can find guides that recommend using the same IP for 2 interfaces. Systemd/dhcpcd work behind the scenes and actually disable one of the conflicting interfaces (or delete one of the addresses.) Try it, you won’t believe your eyes...

Regarding problem 2 and 3, I never intend to use the Raspberry Pi with ethernet, only WiFi, so is it okay for me to not define anything regarding ethernet, and only have?:

Code: Select all

interface wlan0
static ip_address=192.168.1.55/20
static routers=192.168.1.1
static domain_name_servers=192.168.1.33 192.168.1.36

Then regarding problem 1, when I remove those lines from /etc/dhcpcd.conf, and run $ ip -4 addr show, I get as my ip: 192.175.2.175/20 (which worked successfully), which is why I tried doing it earlier with /20.

I now have tried with:

eth0 and wlan0 with /24
eth0 and wlan0 with /20
wlan0 only with /24
wlan0 only with /20

and none of these have worked...

Ernst
Posts: 1333
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 2:43 pm

Please remove the static ip addresses and let dhcp assign the address, then show us the output of the following commands:

Code: Select all

ip -4 addr show
ip -4 route show
cat /etc/resolv.conf
The road to insanity is paved with static ip addresses

PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 2:59 pm

Ernst wrote: Please remove the static ip addresses and let dhcp assign the address, then show us the output of the following commands:

Code: Select all

ip -4 addr show
ip -4 route show
cat /etc/resolv.conf

OK:

Code: Select all

ip -4 addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 192.168.2.175/20 brd 192.168.15.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever

Code: Select all

ip -4 route show
default via 192.168.1.1 dev wlan0 proto dhcp src 192.168.2.175 metric 303
192.168.0.0/20 dev wlan0 proto dhcp scope link src 192.168.2.175 metric 303

Code: Select all

cat /etc/resolv.conf
# Generated by resolvconf
domain <companyname>.local
nameserver 192.168.1.33
nameserver 192.168.1.36

Ernst
Posts: 1333
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 3:42 pm

I think you should speak to your network administrator, 192.168.1.55/20 is technically a valid address within the subnet but it may already be used on some other system. Have you tried to ping 192.168.1.55, if successful it means that the address is in use. If not successful it does not imply that the address is free, it can be that the access point implements client separation.
The road to insanity is paved with static ip addresses

PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 7:09 pm

The network administrator had a great idea. I tested out the dhcpcd.conf file having only an eth0 section. Then I wired the Pi to the network and this time it worked. I had the settings:

Code: Select all

interface eth0
static ip_address=192.168.1.55/20
static routers=192.168.1.1
static domain_name_servers=192.168.1.33 192.168.1.36

This means the problem is something specific to WiFi. One idea I have is wondering whether or not I would have to do something different in /etc/wpa_supplicant/wpa_supplicant.conf. Besides that I don't really have any new ideas. I'm hoping this new information will be enough for someone to help me.

epoch1970
Posts: 5022
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 7:33 pm

I think your admin should have another great idea about the wifi AP under his responsibility...
Your issue has nothing to do with the Pi or even the OS.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 7:41 pm

epoch1970 wrote:
Mon Jul 29, 2019 7:33 pm
I think your admin should have another great idea about the wifi AP under his responsibility...
Your issue has nothing to do with the Pi or even the OS.

Can you please expand on that thought? I'm rather inexperienced. Thanks, I really appreciate it.

epoch1970
Posts: 5022
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Static IP Not Working Raspbian Buster Lite

Mon Jul 29, 2019 7:49 pm

Okay.
In your first post you show wifi is working. You have the static address you want. But access is filtered.
Further along a network admin enters the picture and suggests you try ethernet. You do and it works (filtering issue included I assume.)
Now, go back see the admin, tell him to explain why filtering differs between ethernet and wifi.
Nobody has the answer here, and answering that question is his job.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

PureStress
Posts: 9
Joined: Fri Jul 26, 2019 6:16 pm

Re: [SOLVED] Static IP Not Working Raspbian Buster Lite

Mon Aug 05, 2019 7:06 pm

Alright, the problem was something to do with the admin's setup.

yv6eda
Posts: 2
Joined: Thu Mar 10, 2016 4:00 am

Re: [SOLVED] Static IP Not Working Raspbian Buster Lite

Tue Aug 13, 2019 3:43 am

May you be more specific? Maybe you can help others!

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

Re: [SOLVED] Static IP Not Working Raspbian Buster Lite

Tue Aug 13, 2019 10:42 am

yv6eda wrote:
Tue Aug 13, 2019 3:43 am
May you be more specific? Maybe you can help others!
The problem is within the network he is connecting to , it is obversely a work , school or university network as it has a network administrator ,

how the problem was solved on this network will not help you as it will be specific to the network the OP is connecting to.

if you have a networking problem start a new thread of your own and give as much detail as possible.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

RexRoper
Posts: 70
Joined: Wed Oct 31, 2012 4:45 pm
Location: South Florida
Contact: Website

Re: [SOLVED] Static IP Not Working Raspbian Buster Lite

Wed Feb 05, 2020 11:03 pm

I have been using dhcpcd.conf since its introduction without any issues...until RPi 3 B+ running on Buster Lite. The issue involves the names 'eth0' and 'wlan0' If you want to use these names in your dhcpcd.conf file then you should edit /boot/cmdline.txt file and include net.ifnames=0

This is the method I used to resolve the issue where Buster Lite would not use static IP address settings in dhcpcd.conf on RPi 3B+ units.

I hope this information is found to be useful.
PiRexTech

Return to “Troubleshooting”