bin bash IPTABLES sbin iptables VPN_IF ppp0 VPN_IP ifconfig VPN_IF awk

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
IPTABLES="/sbin/iptables"
VPN_IF="ppp0"
VPN_IP=`ifconfig $VPN_IF | awk '/inet addr:/{sub("addr:", "", $2); print $2}'`
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
modprobe ipt_helper
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ip_nat_irc
modprobe ip_gre
modprobe ip_nat_pptp
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -F
$IPTABLES -X
$IPTABLES -t nat -F
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.0/24 --out-interface $VPN_IF -j SNAT --to-source $VPN_IP