Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

Alternative Linux (iptables) method to resolve in host #102

Open
NITEMAN opened this issue Feb 7, 2015 · 1 comment
Open

Alternative Linux (iptables) method to resolve in host #102

NITEMAN opened this issue Feb 7, 2015 · 1 comment

Comments

@NITEMAN
Copy link

NITEMAN commented Feb 7, 2015

Abusing a bit the loopback interface, we can achieve resolution in the host without messing with dnsmasq nor resolv.conf

Tested on Debian 8 (jessie).

Steps:

  1. Add a local DNS server (we'll choose 127.0.0.53 to avoid collitions) to your network connection, either:
    • If using DHCP networking, edit /etc/dhcp/dhclient.conf and add prepend domain-name-servers 127.0.0.53;
    • If using static networking, add 127.0.0.53 to your network connection via Network Manager (or other means)
  2. Redirect DNS queries on that loopback interface to landrush daemon. Use the following iptables rules:
iptables -t nat -A OUTPUT -p udp -d 127.0.0.53 --dport 53 -j DNAT --to 127.0.0.1:10053
iptables -t nat -A OUTPUT -p tcp -d 127.0.0.53 --dport 53 -j DNAT --to 127.0.0.1:10053

Pros:

  • This may be automated inside landrush, providing a more straightforward integration in Linux

Cons:

  • This method intercepts DNS queries globally, not only for selected domains
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants