Lan wan dns settings

i've following setup:

openwrt router:
fixed ip address 192.168.1.1

mobile phone (+usb-c/ethernet hub) acting as internet modem connected to router wan port
ip address 10.42.0.1

linux machine:
fixed ip address 192.168.1.31
default route 192.168.1.1
dns AUTO

Local browsing is ok, but internet browsing work just if i set dns to MANUAL 10.42.0.1

How do I set router to work with dns AUTO and allow internet browsing?

thanks in advance

you have a cell phone with an ethernet port ?

yes, its an hub usbc-ethernet

OK,

then post your /etc/config/network

If you connect a client directly to the phone, does internet work ?

direct connection works.

here is

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 'fd12:473d:467f::/48'

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

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

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

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 switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

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

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

not a solution, but a work around, use the 6 option from https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#dhcp_options to provide your clients with the DNS IP of the phone, or some other DNS, like 1.1.1.1.

you can also check if adding nameserver 10.42.0.1 to /etc/resolv.conf works.

ciao frollic,
i sent via terminal following command:

uci add_list dhcp.lan.dhcp_option="6,10.42.0.1"
uci commit dhcp
service dnsmasq restart

rebooted router, I still have same issue.

this also doesn't fix the issue

Let's see the following:

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

Also, from the router itself, please run some ping tests:

ping 8.8.8.8
ping 139.59.210.197
ping forum.openwrt.org

Then repeat those tests on a computer behind the router.

root@OpenWrt:~# ubus call system board
{
	"kernel": "5.15.137",
	"hostname": "OpenWrt",
	"system": "Broadcom BCM4716",
	"model": "Netgear WNR3500L",
	"board_name": "0x04CF:3500",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.2",
		"revision": "r23630-842932a63d",
		"target": "bcm47xx/mips74k",
		"description": "OpenWrt 23.05.2 r23630-842932a63d"
	}
}
root@OpenWrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'bcm47xx_soc/bcma0:1'
	option channel '1'
	option band '2g'
	option htmode 'NOHT'
	option disabled '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

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 cachesize '1000'
	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'
	option filter_aaaa '0'
	option filter_a '0'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'
	list dhcp_option '3,192.168.1.1'
	list dhcp_option '6,10.42.0.1'
	list dhcp_option '42,10.42.0.1'
	list dhcp_option '44'

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		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:66
#	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

And what about the ping tests?

ping 8.8.8.8
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=115 time=82.903 ms
64 bytes from 8.8.8.8: seq=1 ttl=115 time=71.084 ms
64 bytes from 8.8.8.8: seq=2 ttl=115 time=69.565 ms
64 bytes from 8.8.8.8: seq=3 ttl=115 time=69.030 ms
64 bytes from 8.8.8.8: seq=4 ttl=115 time=76.390 ms
--- 8.8.8.8 ping statistics ---
32 packets transmitted, 32 packets received, 0% packet loss
round-trip min/avg/max = 68.128/73.719/86.156 ms





ping 139.59.210.197
PING 139.59.210.197 (139.59.210.197): 56 data bytes
64 bytes from 139.59.210.197: seq=0 ttl=54 time=79.520 ms
64 bytes from 139.59.210.197: seq=1 ttl=54 time=71.947 ms
64 bytes from 139.59.210.197: seq=2 ttl=54 time=88.524 ms
64 bytes from 139.59.210.197: seq=3 ttl=54 time=69.000 ms
64 bytes from 139.59.210.197: seq=4 ttl=54 time=66.733 ms
^C
--- 139.59.210.197 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 66.733/75.144/88.524 ms


ping forum.openwrt.org
root@OpenWrt:~# ping forum.openwrt.org
PING forum.openwrt.org (139.59.210.197): 56 data bytes
64 bytes from 139.59.210.197: seq=0 ttl=54 time=77.442 ms
64 bytes from 139.59.210.197: seq=1 ttl=54 time=69.549 ms
64 bytes from 139.59.210.197: seq=2 ttl=54 time=67.098 ms
64 bytes from 139.59.210.197: seq=3 ttl=54 time=76.471 ms
^C
--- forum.openwrt.org ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 67.098/72.640/77.442 ms

Great... so the router itself is working. What about the a device behind the router?

it's a mobile phone connected to the wan router ethernet port througth an usb-c ethernet hub

ok... do you have an app on that device for ping and/or traceroute? That will be really helpful.

no app, no GUI configuration, as far as I know is "trasparent" for the traffic

Sorry... I got confused...

re-reading, I see that the mobile device is the upstream connection.

Please test from the linux box.

this is from linux box

--- 8.8.8.8 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6007ms
rtt min/avg/max/mdev = 67.079/72.098/90.364/7.570 ms


gio@aimec:~$ ping 139.59.210.197
PING 139.59.210.197 (139.59.210.197) 56(84) bytes of data.
64 bytes from 139.59.210.197: icmp_seq=1 ttl=53 time=83.4 ms
64 bytes from 139.59.210.197: icmp_seq=2 ttl=53 time=78.6 ms
64 bytes from 139.59.210.197: icmp_seq=3 ttl=53 time=65.9 ms
^C
--- 139.59.210.197 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 65.929/75.975/83.357/7.360 ms
gio@aimec:~$ 


gio@aimec:~$ ping forum.openwrt.org
ping: forum.openwrt.org: Name or service not known
gio@aimec:~$ 

ok... so this is clearly a DNS related issue that we see only on the downstream device.

  1. Do you have another computer/OS that you can test on the downstream network?
  2. from the linux box, what is the output of:
nslookup forum.openwrt.org
nslookup forum.openwrt.org 8.8.8.8