Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # simple gateway script working on Raspberry PI with HUAWEI E3372 LTE
- #
- #!/bin/sh
- PATH=/usr/sbin:/sbin:/bin:/usr/bin
- LAN="eth0"
- NET="ppp0"
- #
- # delete all existing rules.
- #
- iptables -F
- iptables -t nat -F
- iptables -t mangle -F
- iptables -X
- # Always accept loopback traffic
- iptables -A INPUT -i lo -j ACCEPT
- # Allow established connections, and those not coming from the outside
- iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A INPUT -m state --state NEW -i ! $NET -j ACCEPT
- iptables -A FORWARD -i $NET -o $LAN -m state --state ESTABLISHED,RELATED -j ACCEPT
- # Allow outgoing connections from the LAN side.
- iptables -A FORWARD -i $LAN -o $NET -j ACCEPT
- # Masquerade.
- iptables -t nat -A POSTROUTING -o $NET -j MASQUERADE
- # Don't forward from the outside to the inside.
- iptables -A FORWARD -i $NET -o $NET -j REJECT
- # Enable routing.
- echo 1 > /proc/sys/net/ipv4/ip_forward
Advertisement
Add Comment
Please, Sign In to add comment