NAT with IPTABLES

---

ok it worked but the bind daemon were some misconfigured
so easy dnsmasq made the job: https://how-to.fandom.com/wiki/How_to_set_up_a_NAT_router_on_a_Linux-based_computer
https://medium.com/@TarunChinmai/sharing-internet-connection-from-a-linux-machine-over-ethernet-a5cbbd775a4f
^^ and here the trick were to put in the dnsmasq server’s ip under dns server under win;)

https://www.howtoforge.com/nat_iptables
https://www.revsys.com/writings/quicktips/nat.html
https://www.karlrupp.net/en/computer/nat_tutorial

2Scripts for Linux setup::
Run this script on the host A :
#!/usr/bin/env bash
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig eth1 192.168.0.1 netmask 255.255.255.0
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
Run this script on the host B where xx.xx.xx.xx is your dns server :
#!/usr/bin/env bash
ifconfig eth0 down
ifconfig eth0 192.168.0.2 netmask 255.255.255.0
route del -net default 2>/dev/null
route add default gw 192.168.0.1 2>/dev/null
echo “nameserver xx.xx.xx.xx” > /etc/resolv.conf

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>