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?
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?
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.
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:
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.
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:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
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.
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.
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.
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.