What is MASQUERADE in the context of iptables?

Solution 1:

It is an algorithm dependant on the iptables implementation that allows one to route traffic without disrupting the original traffic.

I use the masquerade algorithm when I want to create a virtual wifi adapter and share my wifi.

Im NOT talking about sharing Ethernet connection through your wifi, Im talking about sharing the wifi connection through your wifi via masquerading it to a virtual adapter. This in effect lets you share your wifi connection through wifi.

.

.

Read this and scroll down to MASQUERADE: http://billauer.co.il/ipmasq-html.html

Read this for more in depth: http://oreilly.com/openbook/linag2/book/ch11.html

All those questions about "Connectify for linux" can be solved by implementing the MASQUERADE algo.

For a direct example visit this page: http://pritambaral.com/2012/05/connectify-for-linux-wireless-hotspot/

I HAVE NOT READ THE LAST LINK!!!! But the following is an accurate excerpt/example.

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -A FORWARD -i wlan0 -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

I really dislike how search engines make the algorithm out to be some evil type of hack.. I use it merely so share my internet with my android phones.

FINAL EDIT: this link is the bestest http://gsp.com/cgi-bin/man.cgi?section=3&topic=libalias

Solution 2:

MASQUERADE is an iptables target that can be used instead of SNAT target (source NAT) when external ip of the inet interface is not known at the moment of writing the rule (when server gets external ip dynamically).