gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.52k stars 552 forks source link

Use netmakers internal dns server #2463

Closed Ponkhy closed 1 year ago

Ponkhy commented 1 year ago

Hello,

would it be possible to use the dns server of netmaker outside of the internally created network? I would like to create a domain override for my netmaker network in OPNSense, so I can query the netmaker hosts inside of the egress network.

Many thanks for any help!

mattkasun commented 1 year ago

assuming the docker ip address of the coredns container is 172.18.0.2 add the following two iptables rules on the netmaker server

iptables -t nat -I PREROUTING -p udp --dport 53 -j DNAT --to-destination 172.18.0.2:53
iptables -t nat -I POSTROUTING -j MASQUERADE

then on another host in the network you should be able to run nslookup <hostname>.<networkname> <wireguardip or netmaker server> and get the wg ip address of <hostname>.<networkname>

Ponkhy commented 1 year ago

Thank you very much!