Internet working but opkg fail

[Solved]Hi

I just installed openwrt on ASUS router. my internet is working but somehow when i run
"opkg update" it fails to detect internet.

Please post here the output of the following commands, copy and paste the whole block:

uci export network; uci export wireless; \
uci export dhcp; uci export firewall; \
head -n -0 /etc/firewall.user; \
ip -4 addr ; ip -4 ro ls tab all ; ip -4 ru; \
ls -l  /etc/resolv.* /tmp/resolv.*; head -n -0 /etc/resolv.* /tmp/resolv.*

Please use "Preformatted text </>" for logs, scripts, configs and general console output.
grafik

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 'fda5:5936:2f34::/48'

config device 'wan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr 

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.2'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.1.8'

config device 'lan_eth0_2_dev'
        option name 'eth0.2'
        option macaddr 

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 2 3 4 6t'

package wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
        option htmode 'VHT80'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 
        option key 
        option encryption 'psk2'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/10180000.wmac'
        option htmode 'HT20'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 
        option key 
        option encryption 'psk2'

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.auto'
        option nonwildcard '1'
        option localservice '1'

config dhcp 'lan'
        option interface 'lan'
        option dhcpv6 'server'
        option ra 'server'
        option ra_management '1'
        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'

package firewall

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

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

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

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 include
        option path '/etc/firewall.user'

# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.

# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
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
13: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    inet 192.168.1.8/24 brd 192.168.1.255 scope global br-lan
       valid_lft forever preferred_lft forever
ip: invalid argument 'ls' to 'ip'
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
lrwxrwxrwx    1 root     root            16 Feb 28 06:05 /etc/resolv.conf -> /tmp/resolv.conf
-rw-r--r--    1 root     root            32 Apr 22 20:09 /tmp/resolv.conf
-rw-r--r--    1 root     root             0 Feb 28 06:05 /tmp/resolv.conf.auto
==> /etc/resolv.conf <==
search lan
nameserver 127.0.0.1

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

==> /tmp/resolv.conf.auto <==

Gateway and DNS server missing here.
This is apparently your second router, and is not using DHCP.
You have assigned an IP address, but you have not told it about the gateway to internet and the DNS name service server...

Add to this lan section:

option dns 192.168.1.1
option gateway 192.168.1.1

(assuming that your main router is 192.168.1.1)

1 Like

Yes, this router is in AP mode. How do I add dns. I added gateway using luci.

DNS setting is on the same page in interface config:

Ok, updated that

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.2'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.1.8'
        option gateway '192.168.1.1'
        option ip6assign '64'
        list dns '192.168.1.1'

Still getting the error

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/packages/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/packages/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/kmods/4.14.171-1-18384755d38fc43c447d83d4a3e07054/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/kmods/4.14.171-1-18384755d38fc43c447d83d4a3e07054/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/base/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/base/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/packages/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/packages/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/routing/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/routing/Packages.gz

Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/telephony/Packages.gz
Failed to establish connection
*** Failed to download the package list from http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/telephony/Packages.gz

Collected errors:
 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7620/kmods/4.14.171-1-18384755d38fc43c447d83d4a3e07054/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/base/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/routing/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/telephony/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

Maybe the internet router is not 192.168.1.1 ?

WAN router is at 192.168.1.1. I am able to access its interface through this.

Did you restart network after applying the changes?
service network restart ; ip -4 addr; ip -4 ro; head -n -0 /etc/resolv.* /tmp/resolv.*

wget http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz
wget http://176.9.48.73/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz
( or uclient-fetch )

Did now. Still facing the same issue.

root@OpenWrt:~# wget http://176.9.48.73/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz
Downloading 'http://176.9.48.73/releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz'
Connecting to 176.9.48.73:80
Failed to redirect to /releases/19.07.2/packages/mipsel_24kc/luci/Packages.gz on downloads.openwrt.org

tracert one.one.one.one and tracert 1.1.1.1 ?

And you have disabled the dnsmasq service in the AP router ?

The advice given to you was based on the "dumb AP" recipe, where the AP is rather dumb and is connected via LAN port to the main router. That also requires that you disable the dnsmasq (DHCP and DNS) in the AP, so tha tthe main router takes care of DNS and DHCP.
https://openwrt.org/docs/guide-user/network/wifi/dumbap

3 Likes

proxy server?

Ok that was the issue. Did not disable these. Thank you all !!

So then...

Please see how to mark the topic as solved

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.