Hello,
Thanks in advance for any help.
Through DHCP I want to assign different DNS to clients, using option 6 editing /etc/config/dhcp and adding
config dhcp 'lan'
list 'dhcp_option' '6,192.168.1.10, 192.168.1.11'
I can assign a different to the router DNS servers (192.168.1.1)
I would like to add the option at the client level, is there a place in Gargoyle where I can add DHCP options at client level like it is possible with OpenWRT (eg. OpenWrt Chaos Calmer 15.05.1) where we can add it at the corresponding "config host" entry?
Thanks
Assign Different DNS to DHCP clients
Moderator: Moderators
Re: Assign Different DNS to DHCP clients
command line only (not through the GUI)
Re: Assign Different DNS to DHCP clients
Hi,ispyisail wrote:command line only (not through the GUI)
Not even through config files? When do you say command line only may you please elaborate a bit more on how to do it?
Thanks in advance
Re: Assign Different DNS to DHCP clients
Hi,ispyisail wrote:viewtopic.php?f=8&t=8505
I know how to access the cli.
I am in need for help on how to set DHCP client level options in gargoyle.
I am having a difficult time to locate where (not how) can I add those client level options.
Thanks
Re: Assign Different DNS to DHCP clients
Have you read the dnsmasq OpenWrt wiki? In particular, the section on assigning individual options to hosts?
https://wiki.openwrt.org/doc/uci/dhcp#c ... l_options1
This is probably the solution you are after, but it isn’t compatible with the Gargoyle GUI. any change you make in the GUI after setting this up might revert it.
https://wiki.openwrt.org/doc/uci/dhcp#c ... l_options1
This is probably the solution you are after, but it isn’t compatible with the Gargoyle GUI. any change you make in the GUI after setting this up might revert it.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
Please be respectful when posting. I do this in my free time on a volunteer basis.
Re: Assign Different DNS to DHCP clients
Thanks.
I ended up using iptables to pre-route blocks of IPs or individual hosts to different DNS's.
Not pretty but easy to track and configure with scripts and custom config files.
I ended up using iptables to pre-route blocks of IPs or individual hosts to different DNS's.
Not pretty but easy to track and configure with scripts and custom config files.
Lantis wrote:Have you read the dnsmasq OpenWrt wiki? In particular, the section on assigning individual options to hosts?
https://wiki.openwrt.org/doc/uci/dhcp#c ... l_options1
This is probably the solution you are after, but it isn’t compatible with the Gargoyle GUI. any change you make in the GUI after setting this up might revert it.
Re: Assign Different DNS to DHCP clients
Mind sharing your solution steps using iptables?setham wrote:I ended up using iptables to pre-route blocks of IPs or individual hosts to different DNS's.
Not pretty but easy to track and configure with scripts and custom config files.
Might help other users in the same/similar situation.
Thanks.
TP-Link Archer C7 v2 - Gargoyle 1.12.X
TP-Link WR842ND v2 - Gargoyle 1.10.X
TP-Link RE450 AC v2 - Stock FW 1.0.4
TP-Link WA850RE v1.2 - LEDE 17.01.1
TP-Link WR842ND v2 - Gargoyle 1.10.X
TP-Link RE450 AC v2 - Stock FW 1.0.4
TP-Link WA850RE v1.2 - LEDE 17.01.1
Re: Assign Different DNS to DHCP clients
Sure thing, but I have to apologize, when looking for the scripts I recalled that I ended up creating the scripts for a pihole running raspbian. Gargoyle has the pihole IP as DNS for DHCP and I run the script on the pihole.d3fz wrote:Mind sharing your solution steps using iptables?setham wrote:I ended up using iptables to pre-route blocks of IPs or individual hosts to different DNS's.
Not pretty but easy to track and configure with scripts and custom config files.
Might help other users in the same/similar situation.
Thanks.
The script can be highly optimized, I use it with a text file that has the hosts or ip-ranges that I want to redirect to a different DNS. Everytime the pihole is rebooted runs the scripts for all the hosts in the text file. Manually you can add or remove hosts on demand.
The concept is the same but I have not tested them in the gargoyle router. I will try to test/port them over the weekend.
Code: Select all
#!/bin/bash
# set -x
if [ $# -ne 4 ];
then echo "illegal number of parameters"
exit 1
fi
if [ "$1" == "-e" ]
then
sysctl -w net.ipv4.conf.all.forwarding=1
iptables -t nat -I PREROUTING -p udp -s $2 --dport 53 -j DNAT --to $3
iptables -t nat -A POSTROUTING -p udp --dport 53 -m conntrack --ctdir ORIGINAL --ctstate DNAT -j SNAT --to-source $4
exit 0
fi
if [ "$1" == "-d" ]
then
sysctl -w net.ipv4.conf.all.forwarding=0
iptables -t nat -D PREROUTING -p udp -s $2 --dport 53 -j DNAT --to $3
iptables -t nat -D POSTROUTING -p udp --dport 53 -m conntrack --ctdir ORIGINAL --ctstate DNAT -j SNAT --to-source $4
exit 0
fi
echo "usage: override_dns.sh -[e|d] ip dns defaultdns"
exit 1
# override_dns.sh -e client dnsserver defaultdns -> enables dnsserver for client
# override_dns.sh -d client dnsserver defaultdns -> deletes dnsserver for client, defaults to dhcp provided