Rule for wireguard device?

Hi,

I run wireguard and pbr, I have one device (my iptv box) using wireguard and I use controlD dns (DoH) on router, what I would like to do is, being able to make a rule for my iptv box, which I want it uses cloudlfare or google dns, could you help me?
thanks

You can set a dns server per client see:

1 Like

but wireguard client needs to be in dhcp, I have nothing about wg in it... you mean, I have to create by myself your exemple right?

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option localservice '1'
	option ednspacket_max '1232'
	list addnmount '/bin/busybox'
	option noresolv '1'

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'

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

config dhcp 'guest'
	option interface 'guest'
	option start '100'
	option limit '150'
	option leasetime '12h'

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

You have to add that manually in /etc/config/dhcp as described

1 Like

I added it,.but no success.

You have to reboot the router and the client and then check on the client if it has got the DNS address and IP address you have set

1 Like

should be good, right?

config tag 'test'
option dhcp_option '6,8.8.8.8,8.8.4.4'

config host
option name 'formuler'
option mac '00:xx:xx:xx:xx:xx'
option ip '192.168.1.241'
option tag 'test'

When everything is restarted router and client, your client should get the ip address of 192.168.1.241 and 8.8.8.8 and 8.8.4.4 as DNS address, provided the client is listening to the DHCP server

1 Like

btw, for the second client, even with ''tag1'' both, the second one does not use google dns.

so I will need to add option dhcp_option '6,8.8.8.8,8.8.4.4' above the second client ?

config tag 'tag1'
        option dhcp_option '6,8.8.8.8,8.8.4.4'

config host
        option name 'hi-sense'
        option mac 'A0:xxxxxxxxxxx'
        option ip '192.168.1.237'
        option tag 'tag1'

config host
        option name 'formuler'
        option mac '00:xxxxxxxxx'
        option ip '192.168.1.241'
        option tag 'tag1'

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