Device specific DNS setup

Want to share your OpenWrt / Gargoyle knowledge? Implemented a new feature? Let us know here.

Moderator: Moderators

Post Reply
billa_d
Posts: 1
Joined: Sun Apr 26, 2020 3:53 pm

Device specific DNS setup

Post by billa_d »

Hello Gargoyle users

I have been recently looking for a solution to my problem regarding setting up custom DNS for certain clients. And after some research within the Gargoyle forums and OpenWRT documentation, I managed to do it.

Again, there are posts asking for similar requirement. The intention of this post is to just make it super clear.

I am using Gargoyle version 1.6.2

I used it to set
  • Few devices to pass through PiHole (this can be any other DNS you want)
  • All other devices to pass through Router's DNS

Steps
- Since the option is not directly available through GUI web interface, you need to SSH to router
viewtopic.php?f=8&t=8505

- Locate and edit the dhcp config file

Code: Select all

vim /etc/config/dhcp
- Add the following content at the bottom(change the values based on your requirement)
Source: forum . OpenWRT . org / t/dns-filtering-for-specific-user/45998

Code: Select all

config host
    option name 'pc_name'
    option mac 'pc:ma:ca:dd:re:ss'
    option ip '192.168.PC.IP'
    option tag 'pihole_dns'  # assign tag "pihole_dns" to this host

 
config tag 'pihole_dns'  # match tag "pihole_dns"
    list dhcp_option '6,192.168.PI.IP'   # 6 = dns
    option force '1' 
Similarly add more hosts. This also links IP address to MAC address unless done from Web interface.

- Reboot

Helpful sources:
viewtopic.php?f=5&t=6375#p25814

Another way of doing it (haven't tried)
linksysinfo . org / index.php?threads/assign-specific-dns-t ... nts.68865/

Post Reply