Not able to connect to Openwrt on RPi 4, strange ip addresses to clients

Good morning beautiful people.

I spent 3 days installing and configuring Openwrt on new Raspberry Pi 4 B with 2BG RAM.

12 hours ago I finished my job and openwrt was working perfectly, I made many reboots and powring off and everything was working perfectly, I disconnected the Raspberry Pi from power and slept.

Now I am trying to connect to it on both eth and wifi but I received different errors, a linux device showing error "unable to activate connection" and there was no IP address. a Mac was able to connect but without internet, the ip it got was strange, 165.xxx.xx.xxx and there is no Gate ip address, I tried to connect to openwrt using ssh and web interface but couldn't reach it.

Can anyone please tell me what and why this happened? How to prevent it in the future?

Thanks in advance :smiling_face:

How are things connected together in your network? How are you connecting your OpenWrt Pi to your computer (are you using the built-in ethernet port and is there anything else between the Pi and the computer?

I used a Ralink usb Wifi mt7610u as wan input, the built-in eth and wifi as lan.

I connected my pc using eth cable but when I faced the problem I tried to connect a mac laptop using wifi. No other devices connected to the RPi.

Try unplugging the wan. Then plug your computer into the built-in ethernet port and see if you get a normal RFC1918 IP address.

Sorry for not mentioning the info you need but what should I say? It's Raspberry pi and openwrt, I just attached a Ralink usb wifi as wan input and set firewall to drop wan to device and wan to lan connections. Everything else is the openwrt defaults.

I read the post differently the 1st time I read it, sorry, reply deleted.

Anyway, I think @psherman is on to something. when he's telling you to move the LAN cable.

I removed the wan usb Wifi adapter, still the same problem on both built-in eth and wifi.

then you'll probably need to hook it up to a monitor ...

1 Like

Well, the good news is that it is impossible to brick a Pi because the installation is on removable media. Aside from the option to use a keyboard and display on the pi, you have two other options:

  1. take the card out and put it into a comptuter. This will allow you to pull the config files that we can review and suggest edits to fix.
  2. erase the card and perform the install of OpenWrt again

If you opt for the first...

Please find the following files and copy the contents here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

/etc/config/network
/etc/config/wireless
/etc/config/dhcp
/etc/config/firewall

Thanks @psherman I am not able to find the files /etc/config/network and /etc/config/wireless

dhcp:

config dnsmasq
        option domainneeded     1
        option boguspriv        1
        option filterwin2k      0  # enable for dial on demand
        option localise_queries 1
        option rebind_protection 1  # disable if upstream must serve RFC1918 ad>
        option rebind_localhost 1  # enable for RBL checking and similar servic>
        #list rebind_domain example.lan  # whitelist RFC1918 responses for doma>
        option local    '/lan/'
        option domain   'lan'
        option expandhosts      1
        option nonegcache       0
        option cachesize        1000
        option authoritative    1
        option readethers       1
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.d/resolv.conf.auto'
        #list server            '/mycompany.local/1.2.3.4'
        option nonwildcard      1 # bind to & keep track of interfaces
        #list interface         br-lan
        #list notinterface      lo
        #list bogusnxdomain     '64.94.110.11'
        option localservice     1  # disable to allow DNS requests from non-loc>
        option ednspacket_max   1232
        option filter_aaaa      0
        option filter_a         0
        #list addnmount         /some/path # read-only mount path to expose it >

config dhcp lan
        option interface        lan
        option start    100
        option limit    150
        option leasetime        12h

config dhcp wan
        option interface        wan
        option ignore   1

firewall:

config defaults
	option syn_flood	1
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option dest		wan
#	option proto	tcp
#	option target	REJECT

# block a specific mac on wan
#config rule
#	option dest		wan
#	option src_mac	00:11:22:33:44:55
#	option target	REJECT

# block incoming ICMP traffic on a zone
#config rule
#	option src		lan
#	option proto	ICMP
#	option target	DROP

# port redirect port coming in on wan to lan
#config redirect
#	option src			wan
#	option src_dport	80
#	option dest			lan
#	option dest_ip		192.168.16.235
#	option dest_port	80
#	option proto		tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#	option src		wan
#	option src_dport	22001
#	option dest		lan
#	option dest_port	22
#	option proto		tcp

### FULL CONFIG SECTIONS
#config rule
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port	80
#	option dest		wan
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp
#	option target	REJECT

#config redirect
#	option src		lan
#	option src_ip	192.168.45.2
#	option src_mac	00:11:22:33:44:55
#	option src_port		1024
#	option src_dport	80
#	option dest_ip	194.25.2.129
#	option dest_port	120
#	option proto	tcp

But looks like these are the defaults confs? I am not seeing my firewall settings for example.

Thanks, I will order an HDMI cable now.

If they are missing from your card, something went seriously wrong. At this point, you will be best served by simply erasing the card and rewriting a fresh copy of the openwrt image.

I agree, unless you've done serious (re)configs, start from scratch, it's safer.

1 Like

And faster. Literally a few minutes to accomplish.

Thank you very much for your time and help, what can it be the reason please? for example disconnecting RPi from power for many hours? should I keep it always plugged?

The files should be there. If they’re not, something very unusual happened (or maybe you or some non-default process accidentally deleted them). Since we can’t identify the cause of this, best to simply start over.

1 Like

Thank you very much for the info, will start over.

How did you power off the rpi4? Just disconnecting the rpi4 from power is a very, very bad idea.

As every linux/unix has open files and current data in caches, it is absolutely necessary to shutdown the running system. Just ssh to the rpi4 and enter a shutdown or poweroff command. Then all caches will be written to disk and the filesystems will be unmounted. This step insures data integrity.

Probably because they were never written to disk.

Just disconnecting a rpi4 with an ext4 filesystem from power is IMHO seriously wrong.

No, just enter a shutdown or poweroff command and after the shutdown process is completed then turn off the power.

During the shutdown process the yellow LED will blink (that means: data is written to the sd-card). The process finishes with two long blinks. Then the yellow LED goes off and stays off. This all is described on the raspberry website.

For example cutting off the power without a previous shutdown.

I agree 100%. The sudo shutdown now command is a must. Been there, done that, learned it the hard way.
Secondly, the SD cards have a very nasty habit of giving up the ghost when one least expects it. Usually, it begins with some sectors and after a while it becomes unusable, no matter the brand.
Consider a SSD hooked up via USB as system drive and also use a 5 Amp power source. That's how my RPi4 operates flawlessly for over a year now.

Getting a decent power supply is sensible. Hooking up an SSD is arguably overkill. Just invest in an SD card from a reputable brand and you should be fine. My RPi4 has been on pretty much non-stop for about 2.5 years now without issue.

1 Like