[Solved] OpenWrt raspberry pi4 and network settings

I tried to access the graphical interface 192.168.1.1 immediately after the flash of the fw, but it does not access.

ERR_CONNECTION_REFUSED

from putty I access in ssh, but when I give the command opkg update it returns error.

root@OpenWrt:~# opkg update
Downloading https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz

Collected errors:
 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

The pc obviously surfs the internet via wifi while connected to the ethernet port with the pi4.

i deactivated dhcp and ipv6, nothing ...
i tried to ping

root@OpenWrt:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network unreachable

i tried ifconfig


root@OpenWrt:~# ifconfig
br-lan    Link encap:Ethernet  HWaddr DC:A6:32:A9:16:B3
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::dea6:32ff:fea9:16b3/64 Scope:Link
          inet6 addr: fd72:4e1c:bae5::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:913 errors:0 dropped:0 overruns:0 frame:0
          TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:77014 (75.2 KiB)  TX bytes:46498 (45.4 KiB)

eth0      Link encap:Ethernet  HWaddr DC:A6:32:A9:16:B3
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:915 errors:0 dropped:2 overruns:0 frame:0
          TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:89916 (87.8 KiB)  TX bytes:46498 (45.4 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:688 errors:0 dropped:0 overruns:0 frame:0
          TX packets:688 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:53360 (52.1 KiB)  TX bytes:53360 (52.1 KiB)


i tried command route...

 route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

I do not know what to do. help me!

Did you setup wan interface for dhcp? You have no internet connection.

no, I haven't configured anything yet because they are quite noobs

uci set dhcp.lan.ignore=1
uci set network.lan.ipaddr='192.168.X.Y'
uci set network.lan.dns='192.168.X.Z'
uci set network.lan.gateway='192.168.X.Y'
uci commit network
uci commit dhcp
service dnsmasq restart
ifup lan

where 192.168.X.Y use a unique address for the RPi and 192.168.X.Z the ISP router address.

2 Likes

despite the new settings, it keeps failing to download packages

 ifconfig
br-lan    Link encap:Ethernet  HWaddr DC:A6:32:A9:16:B3
          inet addr:192.168.3.1  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::dea6:32ff:fea9:16b3/64 Scope:Link
          inet6 addr: fd29:3507:83f8::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1827 errors:0 dropped:0 overruns:0 frame:0
          TX packets:632 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:209533 (204.6 KiB)  TX bytes:42997 (41.9 KiB)

eth0      Link encap:Ethernet  HWaddr DC:A6:32:A9:16:B3
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1828 errors:0 dropped:1 overruns:0 frame:0
          TX packets:632 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:235171 (229.6 KiB)  TX bytes:42997 (41.9 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1258 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1258 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:117684 (114.9 KiB)  TX bytes:117684 (114.9 KiB)

root@OpenWrt:~# opkg update
Downloading https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz

Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz
Failed to send request: Operation not permitted
*** Failed to download the package list from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz

Collected errors:
 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/base/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/kmods/5.4.81-1-f0ce86fc6a6908c7275a13331c8317ed/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/freifunk/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/luci/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/routing/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a72/telephony/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

The settings don't look correct. Which address did you use for gateway and dns?

1 Like

192.168.3.1 for raspberry pi4
192.168.1.1 gateway IP for internet key alcatel ik40

but I also tried other settings

root@OpenWrt:~# uci set dhcp.lan.ignore=1
root@OpenWrt:~# uci set network.lan.ipaddr='192.168.3.1'
root@OpenWrt:~# uci set network.lan.dns='192.168.1.2'
root@OpenWrt:~# uci set network.lan.gateway='192.168.3.1'
root@OpenWrt:~# uci commit network
root@OpenWrt:~# uci commit dhcp
root@OpenWrt:~# service dnsmasq restart
root@OpenWrt:~# ifup lan

root@OpenWrt:~# uci set dhcp.lan.ignore=1
root@OpenWrt:~# uci set network.lan.ipaddr='192.168.1.1'
root@OpenWrt:~# uci set network.lan.dns='192.168.1.2'
root@OpenWrt:~# uci set network.lan.gateway='192.168.1.1'
root@OpenWrt:~# uci commit network
root@OpenWrt:~# uci commit dhcp
root@OpenWrt:~# service dnsmasq restart
root@OpenWrt:~# ifup lan```

Then you should assign ipaddr 192.168.1.X (one not used by any other device) dns and gateway 192.168.1.1

still not going

root@OpenWrt:~# uci set dhcp.lan.ignore=1
root@OpenWrt:~# uci set network.lan.ipaddr='192.168.1.100'
root@OpenWrt:~# uci set network.lan.dns='192.168.1.1'
root@OpenWrt:~# uci set network.lan.gateway='192.168.1.1'
root@OpenWrt:~# uci commit network
root@OpenWrt:~# uci commit dhcp
root@OpenWrt:~# service dnsmasq restart
root@OpenWrt:~# ifup lan

traceroute downloads.openwrt.org ?

traceroute: bad address 'downloads.openwrt.org'

addresses used

root@OpenWrt:~# uci set network.lan.ipaddr='192.168.1.100'
root@OpenWrt:~# uci set network.lan.dns='192.168.1.1'
root@OpenWrt:~# uci set network.lan.gateway='192.168.1.1'

thank you very much anyway for the effort to help me

The dns is not working. Try to use another one.

uci set network.lan.dns='1.1.1.1'
uci commit network
ifup lan

it still does not work. I tried to put the internet key on the pc and it works ...

you can not download the file manually opkg update and put in the microsd of the pi4? so I configure it as a graphic design

What is the internet key?

You'd need to download the dependencies as well.

Do the following and post here the output:

uci export network; uci export firewall; uci export dhcp; \
ip -4 addr; ip -4 ro; ip -4 ru; \
ls -l  /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/* ; head -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/* ;\
ping -c 3 downloads.openwrt.org; ping -c 3 168.119.138.211
root@OpenWrt:~# uci export network
package network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd29:3507:83f8::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option gateway '192.168.1.1'
        option ipaddr '192.168.1.100'
        option dns '8.8.8.8'

root@OpenWrt:~# uci export firewall
package firewall

config defaults
        option syn_flood '1'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'

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'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

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'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        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'

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'

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'

config rule
        option name 'Support-UDP-Traceroute'
        option src 'wan'
        option dest_port '33434:33689'
        option proto 'udp'
        option family 'ipv4'
        option target 'REJECT'
        option enabled 'false'

config include
        option path '/etc/firewall.user'

root@OpenWrt:~# uci export dhcp
package dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ignore '1'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

root@OpenWrt:~# ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    inet 192.168.1.100/24 brd 192.168.1.255 scope global br-lan
       valid_lft forever preferred_lft forever
root@OpenWrt:~# ip -4 ro
default via 192.168.1.1 dev br-lan
192.168.1.0/24 dev br-lan scope link  src 192.168.1.100
root@OpenWrt:~# ip -4 ru
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
root@OpenWrt:~# ls -l  /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
lrwxrwxrwx    1 root     root            16 Dec  9 07:42 /etc/resolv.conf -> /tmp/resolv.conf
-rw-r--r--    1 root     root            47 Dec  9 09:56 /tmp/resolv.conf
-rw-r--r--    1 root     root            35 Dec  9 09:56 /tmp/resolv.conf.d/resolv.conf.auto

/tmp/resolv.conf.d:
-rw-r--r--    1 root     root            35 Dec  9 09:56 resolv.conf.auto
root@OpenWrt:~# head -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
==> /etc/resolv.conf <==
search lan
nameserver 127.0.0.1
nameserver ::1

==> /tmp/resolv.conf <==
search lan
nameserver 127.0.0.1
nameserver ::1

==> /tmp/resolv.conf.d <==
head: /tmp/resolv.conf.d: I/O error

==> /tmp/resolv.conf.d/resolv.conf.auto <==
# Interface lan
nameserver 8.8.8.8
root@OpenWrt:~# ping -c 3 downloads.openwrt.org
ping: bad address 'downloads.openwrt.org'
root@OpenWrt:~# ping -c 3 168.119.138.211
PING 168.119.138.211 (168.119.138.211): 56 data bytes

--- 168.119.138.211 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

Are you able to ping the gateway? Everything looks correct, but there doesn't seem to be any internet connectivity
Do also a traceroute:
ping -c 3 192.168.1.1; traceroute 1.1.1.1

The instructions above are for connecting to an existing wired Ethernet network that leads to the Internet.

An "Internet Key" or 4G USB modem is not plug and play on OpenWrt. It requires the installation of driver packages.

1 Like

and how can I solve the problem?

if i connect the pi 4 in wifi right to make the updates? it is feasible? then from the graphical interface I do the rest