I want to share my Interent connection from my linux to another equipment.
First you have to enable NAT in your linux,
as root you must type:
# iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
Then, logged as root, you have to enable IP forwarding.
There are two ways:
# sysctl -w net.ipv4.ip_forward=1
# echo 1 > /proc/sys/net/ipv4/ip_forward
Now you have to configure in your other device the IP of your linux as default gateway.
And that’s all folks!
If you have problems with iptables and you want to remove all the rules write:
iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT