DNS with OpenWRT as client

Hi all

I'm trying to use OpenWRT as a client using this guide. It seems to be almost working, but clients are missing DNS information with DHCP - and I'm having trouble with figurering out how to provide the information.

A hint please? :slight_smile:

Welcome to the community!

Can you provide a more detailed description of this issue. I assume it means you connected the OpenWrt to a WWAN successfully; but the clients on the OpenWrt's LAN have no hostname resolution, correct?

Your Wan interface gets DNS server from client network?
Or your clients (clients of your router)?
Make a scheme, hard to understand what exactly going on there

1 Like

This is correct. :slight_smile:

The router running OpenWRT successfully connecs to the existing WLAN, and clients connected to the LAN ports of the router gets an IP adress and gateway address though DHCP. DNS servers is missing though - so running ..

ipconfig /all | find /i "DNS Servers"

.. on the connected clients, does not return anything. I've tiried fiddling with the DHCP settings of OpenWRT, but I havn't quite found the problem yet.

1 Like

Thanks for the clarity.

Please provide those settings:

cat /etc/config/network
cat /etc/config/dhcp
cat /etc/config/firewall

Also, let is know the WWAN IP:

ifstatus wan | grep '"address":'

or

ifstatus wwan | grep '"address":'

Thanks for spendijng the time, trying to help out a newbie. :hugs:

Actually I think that the main problem is - that there is no working route from the LAN ports to the WiFi antennas - so to speak. Trying to ping 8.8.8.8 or 192.168.1.1 (existing network) does not succeed. :thinking:

root@OpenWrt:~# cat /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 'fda4:27f3:3f4d::/48'

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

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

config device
option name 'eth0.2'
option macaddr '18:a6:f7:cf:83:13'

config interface 'wan'
option device 'eth0.2'
option proto 'dhcp'

config interface 'wan6'
option device 'eth0.2'
option proto 'dhcpv6'

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

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

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

config switch_vlan
option device 'switch1'
option vlan '2'
option ports '0 6t'

config interface 'wwan'
option proto 'dhcp'

root@OpenWrt:~# cat /etc/config/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 dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
list ra_flags 'managed-config'
list ra_flags 'other-config'
option dns_service '0'

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:~# cat /etc/config/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'
list network 'lan'

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

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 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'

root@OpenWrt:~# ifstatus wan | grep '"address":'
root@OpenWrt:~# ifstatus wwan | grep '"address":'
"address": "192.168.1.53",

by default owrt collects upstream dns info from wan, stores in above file. this is used by the local dns server (dnsmasq) to forward queries if local dns server cannot answer. i.e. to forward all internet host requests.

what does above file contain? if you run nslookup google.com command on the router what is the result?
you can set dns servers for your owrt clients by using dhcp_option by the way.


your wwan interface is in which firewall zone? do you have forwarding zone configured from lan to wwan's zone?

note: there is "preformatted text" option in post editor for content like config files, which makes it more console output like.

Just make a dumb AP of your client router
and DHCP will come from internet router
try WDS AP WDS client mode on wifi
disable everything on client (firewall all dhcp )

Or if you need sub network? like clients have their own network ?

I found the problem: The router needs a reboot, after following the guide from the original posting.

1: Reset the router
2: Follow the guide
3: Reboot

.. and the it works as a charm.

1 Like

Wonderful!

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

Well .. it turns out that the problem isn't solved. :slight_smile:

The problem may be due to incompatibility - as I found another router, and here it works as a charm. The router causing issues is a TP-LINK Archer C2 AC750 - and the one working out of the box, so to speak, is a D-LINK DIR-842 C1E.