Difference between revisions of "Iptables on Ubuntu 14.04"

From MyWiki
Jump to: navigation, search
(Blanked the page)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Reference - https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04<br>
+
 
All commands assume root level access<br>
+
iptables -L  [ -n ]<br>
+
iptables -S  ( reflects the commands necessary ) <br>
+
iptables -F  ( flush the current rules ) <br><br>
+
'''Connecting to a vm from external''' ( This is good, it works )<br>
+
<source lang="text">
+
iptables -t nat -I PREROUTING -p tcp -d 1.2.3.4 --dport 80 -j DNAT --to-destination 10.0.0.1:80
+
iptables -t nat -I PREROUTING -p tcp -d 1.2.3.4 --dport 22 -j DNAT --to-destination 10.0.0.2:22
+
iptables -I FORWARD -m state -d 10.0.0.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT
+
</source>
+

Latest revision as of 16:11, 2 June 2018