{"id":426,"date":"2012-08-23T12:39:43","date_gmt":"2012-08-23T12:39:43","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=426"},"modified":"2014-03-05T15:12:30","modified_gmt":"2014-03-05T15:12:30","slug":"nat-routing-on-linux","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=426","title":{"rendered":"NAT Routing on Linux"},"content":{"rendered":"<p><a href=\"http:\/\/www.cyberciti.biz\/faq\/howto-configure-network-address-translation-or-nat\/\">Linux configure Network Address Translation or NAT<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# echo &quot;1&quot; &gt; \/proc\/sys\/net\/ipv4\/ip_forward\r\n# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\r\n# iptables -L\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n####### ROUTER \/ GATEWAY #######\r\n\r\n# Flush rules from iptables\r\niptables -F\r\n\r\n# Flush rules from nat table in iptables\r\niptables -t nat -F\r\n\r\n# IP Forwarding (global)\r\necho 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward\r\n# oder (f\u00fcr jedes Interface einzeln)\r\necho 1 &gt; \/proc\/sys\/net\/ipv4\/conf\/eth0\/forwarding\r\n\r\n# Regeln definieren\r\nINET_IF=eth0\r\nLOCAL_IF=eth4\r\niptables -t nat -A POSTROUTING -o $INET_IF -j MASQUERADE\r\niptables -A FORWARD -i $INET_IF -o $LOCAL_IF -m state --state RELATED,ESTABLISHED -j ACCEPT\r\niptables -A FORWARD -i $LOCAL_IF -o $INET_IF -j ACCEPT\r\n\r\n# \u00dcberpr\u00fcfen\r\niptables -t nat -v --list\r\niptables -v --list\r\n\r\n#######  CLIENT #######\r\n\r\nGATEWAY=192.168.1.1\r\nroute add default gw $GATEWAY\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux configure Network Address Translation or NAT # echo &quot;1&quot; &gt; \/proc\/sys\/net\/ipv4\/ip_forward # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # iptables -L ####### ROUTER \/ GATEWAY ####### # Flush rules from iptables iptables -F # Flush rules from nat table in iptables iptables -t nat -F # IP Forwarding (global) echo 1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-426","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=426"}],"version-history":[{"count":3,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions"}],"predecessor-version":[{"id":2025,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions\/2025"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}