[BoF]-----------------------------------------------------------
#!/bin/bash
## mendadak router
## tonca.notes
if [[ -z $1 || -z $2 ]]; then
echo "Usage: $0 <local_interface> <to_outside_interface> \n";
fi
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface $2 -j MASQUERADE
iptables --append FORWARD --in-interface $1 -j ACCEPT
echo "1" > /proc/sys/net/ipv4/ip_forward
[EoF]----------------------------------------------------------------------