[SOLVED] Need help with OpenWrt config behind other router

I have a bit of a complicated setup right now:
Cable Internet goes into a DOCSIS router provided by our ISP. This router can't be replaced unfortunately, so it is set to bridge mode into an existing (non openwrt) router, which is doing all the things you would expect a router to do (dns, dhcp etc.). This one will eventually be replaced by the openwrt machine (x86 Celeron) I'm in the process of setting up. Currently my openwrt router is plugged into this router (my own one, not the one from my ISP) as well with the eth1 port. It is also receiving an internal ip address and on my main router no restrictions are set. On the eth0 port my computer is plugged in, I can access luci via 192.168.1.1 or openwrt.lan.

If I ssh into the router and run ping 8.8.8.8, it works as expected, however, ping google.com will return bad address 'google.com'. On my computer if I try to access google.com in the browser I'm getting a DNS_PROBE_FINISHED_BAD_CONFIG and accessing Google via 8.8.8.8 directly will run into a timeout. What could be the issue here?

I have used the Image Builder to compile an 21.02.0-rc2 x86_64 generic image with make image PROFILE=generic PACKAGES="luci docker dockerd".

root@OpenWrt:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=114 time=14.969 ms
64 bytes from 8.8.8.8: seq=1 ttl=114 time=12.607 ms
64 bytes from 8.8.8.8: seq=2 ttl=114 time=12.102 ms
64 bytes from 8.8.8.8: seq=3 ttl=114 time=13.993 ms
64 bytes from 8.8.8.8: seq=4 ttl=114 time=11.417 ms
64 bytes from 8.8.8.8: seq=5 ttl=114 time=13.164 ms
64 bytes from 8.8.8.8: seq=6 ttl=114 time=14.771 ms
^C
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 11.412/13.288/14.969 ms

root@OpenWrt:/# ping google.com
ping: bad address 'google.com'

root@OpenWrt:/# ifconfig -a
br-lan      Link encap:Ethernet  HWaddr 00:F1:4F:68:29:58
            inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
            inet6 addr: XX Scope:Global
            inet6 addr: fe80::2f1:4fff:fe68:2958/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:16992 errors:0 dropped:0 overrunns:0 frame:0
            TX packets:13811 errors:0 dropped:0 overruns:0 carrier:0
            collisions: 0 txqueuelen:1000
            RX bytes:2453975 (2.3 MiB)  TX bytes:4403021 (4.1 MiB)

docker 0    Link encap:Ethernet  HWaddr 02:42:EF:23:53:BC
            inet addr:172.17.0.1  Bcase:172.17.255.255  Mask:255.255.0.0
            UP BROADCAST MULTICAST  MTU:1500   Metric:1
            RX packets:0 errors:0 dropped:0 overrun:0 frame:0
            TX packets:0 errors:0 dropped:0 overrun:0 carrier:0
            collisions:0 txqueuelen:0
            RX bytes:0 (0.0B)  TX bytes:0 (0.0B)

eth0        Link encap:Ethernet  HWaddr:00:F1:4F:68:29:58
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:16998 errors:0 dropped:2 overruns:0 frame:0
            TX packets:13811 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:2718244 (2.5 MiB)  TX bytes:4403021 (4.1 MiB)

eth1        Link encap:Ethernet  HWaddr:10:78:68:01:FE
            inet addr:192.168.1.38   Bcast:192.168.1.255  Mask:255.255.255.0
            inet6 addr:fe80::1278:32ff:fe68:1fe/64 Scope:Link
            inet6 addr:XX Scope:Global
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:8543 errors:0 dropped:3839 overruns:0 frame:0
            TX packets:561 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:931961 (910.1 KiB)  TX bytes:74284 (72.5 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:2936 errors:0 dropped:0 overruns:0 frame:0
            TX packets:2936 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:222678 (217.4 KiB)  TX bytes:222678 (217.4 KiB)

root@OpenWrt:/# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].filterwin2k='0'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].nonegcache='0'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='100'
dhcp.lan.limit='150'
dhcp.lan.leasetime='12h'
dhcp.lan.dhcpv4='server'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.ra_slaac='1'
dhcp.lan.ra_flags='managed-config' 'other-config'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcp-update'
dhcp.odhcpd.loglevel='4'

root@OpenWrt:/# netstat -lnp | grep dnsmasq
tcp        0      0 192.168.1.38:53         0.0.0.0:*              LISTEN      3188/dnsmasq
tcp        0      0 127.0.0.1:53            0.0.0.0:*              LISTEN      3188/dnsmasq
tcp        0      0 192.168.1.1:53          0.0.0.0:*              LISTEN      3188/dnsmasq
tcp        0      0 172.17.0.1:53           0.0.0.0:*              LISTEN      3188/dnsmasq
tcp        0      0 XX:53                   :::*                   LISTEN      3188/dnsmasq
tcp        0      0 fe80::1278:32ff:fe68:1fe:53 :::*               LISTEN      3188/dnsmasq
tcp        0      0 fd2b:67eb:adf9::1:53    :::*                   LISTEN      3188/dnsmasq
tcp        0      0 fe80::2f1:4fff:fe68:2958:53 :::*               LISTEN      3188/dnsmasq
tcp        0      0 ::1:53                  :::*                   LISTEN      3188/dnsmasq
udp        0      0 192.168.1.38:53         0.0.0.0:*              LISTEN      3188/dnsmasq
udp        0      0 127.0.0.1:53            0.0.0.0:*              LISTEN      3188/dnsmasq
udp        0      0 192.168.1.1:53          0.0.0.0:*              LISTEN      3188/dnsmasq
udp        0      0 172.17.0.1:53           0.0.0.0:*              LISTEN      3188/dnsmasq
udp        0      0 XX:53                   :::*                   LISTEN      3188/dnsmasq
udp        0      0 fe80::1278:32ff:fe68:1fe:53 :::*               LISTEN      3188/dnsmasq
udp        0      0 fd2b:67eb:adf9::1:53    :::*                   LISTEN      3188/dnsmasq
udp        0      0 fe80::2f1:4fff:fe68:2958:53 :::*               LISTEN      3188/dnsmasq
udp        0      0 ::1:53                  :::*                   LISTEN      3188/dnsmasq

root@OpenWrt:/# nslookup openwrt.org 8.8.8.8
;; connection timed out; no servers could be reached

root@OpenWrt:/# nslookup openwrt.org 127.0.0.1
;; connection timed out; no servers could be reached

root@openWrt:/# nslookup $(uci get network.lan.ipaddr)
Server:         127.0.0.1
Address:        127.0.0.1#53

1.1.168.192.in-addr.arpa            name = OpenWrt.lan

root@openWrt:/# vi /etc/config/network
config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd2b:67eb:adf9::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

config interface 'docker'
        option proto 'none'
        option auto '0'
        option device 'docker0'

config defice 'docker0'
        option type 'bridge'
        option name 'docker0'
        list ports 'docker0'

Unfortunately, I'm quite a novice regarding networking stuff, so any help is appreciated.

which ports are used between the old router and the openwrt device ?

How can I check the ports?

which as in what kind, LAN or WAN ?

Ah, I see. I think it's currently set up as a WAN port on the OpenWrt device and in the normal LAN network of my router.
I have edited my main post and attached the content of /etc/config/network, I think it should be in that file? Otherwise let me know if I should post any other files.

if you're connecting LAN->WAN, make sure the two routers doesn't use the same subnet - 192.168.1.

br-lan have 192.168.1.1
eth1 have 192.168.1.38

eth1 seems to be the WAN port, so it'll not work.

Ok, I think that is how it is currently set up. Both routers are using 192.168.1. If I understand you correctly, changing the subnet in my OpenWrt router to e.g. 192.168.2 should fix my issue.

yes, correct.

I have changed the interface in /etc/config/network to

config interface 'lan'
        option device 'br-lan' 
        option proto 'static'
        option ipaddr '192.168.3.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

Now everything is working! Thanks :slight_smile:

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