Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # iptables example configuration script
- #
- # Flush all current rules from iptables
- #
- iptables -F
- #
- # Set default policies for INPUT, FORWARD and OUTPUT chains
- #
- iptables -P INPUT ACCEPT
- iptables -P FORWARD ACCEPT
- iptables -P OUTPUT ACCEPT
- #
- # Allow SSH connections on tcp port 22
- #
- iptables -A INPUT -i eto0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -o eto0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
- #
- # Set access for localhost
- #
- iptables -A INPUT -i lo -j ACCEPT
- #
- # Accept connections on 1194 for vpn access from client
- #
- iptables -A INPUT -i eth0 -p udp --dport 1194 -m state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -o eth0 -p udp --sport 1194 -m state --state ESTABLISHED -j ACCEPT
- #
- # Apply forwarding for OpenVPN Tunneling
- #
- iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
- iptables -t nat -A POSTROUTING -s 10.8.0.0./24 -o eth0 -j MASQUERADE
- iptables -A FORWARD -j REJECT
- #
- # Enable forwarding
- #
- echo 1 > /proc/sys/net/ipv4/ip_forward
- #
- # List rules
- #
- iptables -L -v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement