--- title: "nat" date: 2016-12-13T09:14:00 date_display: Dec 13, 2016 --- Mise en place du NAT sur archlinux : ```sh # ip link set up dev net0 # ip addr add 192.168.123.100/24 dev net0 # sysctl net.ipv4.ip_forward=1 # iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE # iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT # iptables -A FORWARD -i net0 -o internet0 -j ACCEPT ``` Mise en place d'une ip fixe sur debian : ```sh # ifconfig eth0 192.168.123.101 netmask 255.255.255.0 # route add default gw 192.168.123.100 eth0 ``` Sources : - [https://wiki.archlinux.org/index.php/Internet_sharing](https://wiki.archlinux.org/index.php/Internet_sharing) - [http://www.howtogeek.com/118337/stupid-geek-tricks-change-your-ip-address-from-the-command-line-in-linux/](http://www.howtogeek.com/118337/stupid-geek-tricks-change-your-ip-address-from-the-command-line-in-linux/)