Created
January 4, 2017 00:39
-
-
Save swarn/99cb2aebd831f9b4527db030e5a11fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*nat | |
:PREROUTING ACCEPT [0:0] | |
:INPUT ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:POSTROUTING ACCEPT [0:0] | |
# p4p1 is WAN interface, #p1p1 is LAN interface | |
-A POSTROUTING -o p4p1 -j MASQUERADE | |
# NAT pinhole: HTTP from WAN to LAN | |
-A PREROUTING -p tcp -m tcp -i p4p1 --dport 80 -j DNAT --to-destination 192.168.99.100:80 | |
COMMIT | |
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
# Service rules | |
# basic global accept rules - ICMP, loopback, traceroute, established all accepted | |
-A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT | |
-A INPUT -p icmp -j ACCEPT | |
-A INPUT -m state --state ESTABLISHED -j ACCEPT | |
# enable traceroute rejections to get sent out | |
-A INPUT -p udp -m udp --dport 33434:33523 -j REJECT --reject-with icmp-port-unreachable | |
# DNS - accept from LAN | |
-A INPUT -i p1p1 -p tcp --dport 53 -j ACCEPT | |
-A INPUT -i p1p1 -p udp --dport 53 -j ACCEPT | |
# SSH - accept from LAN | |
-A INPUT -i p1p1 -p tcp --dport 22 -j ACCEPT | |
# DHCP client requests - accept from LAN | |
-A INPUT -i p1p1 -p udp --dport 67:68 -j ACCEPT | |
# drop all other inbound traffic | |
-A INPUT -j DROP | |
# Forwarding rules | |
# forward packets along established/related connections | |
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
# forward from LAN (p1p1) to WAN (p4p1) | |
-A FORWARD -i p1p1 -o p4p1 -j ACCEPT | |
# allow traffic from our NAT pinhole | |
-A FORWARD -p tcp -d 192.168.99.100 --dport 80 -j ACCEPT | |
# drop all other forwarded traffic | |
-A FORWARD -j DROP | |
COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment