#!/bin/sh # Internal Device = eth0 # Internal IP = 192.168.0.1 ############### ############### # Copied from http://www.debian-administration.org/articles/23 # # "Setting up a simple Debian gateway" (modded a lot) # ############### ############### PATH=/usr/sbin:/sbin:/bin:/usr/bin # # 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 ! eth1 -j ACCEPT iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT ############### ############### # End of debian-administration iptables rules # ############### ############### ############### ############### # Copied from http://www.debian-administration.org/articles/73 # # http://www.hackorama.com/network/portfwd.shtml # "Port forwarding for iptables (DMZ)" (Modded a lot) # # The instructions are for a different machine, I'm trying for this one. # ############### ############### iptables -t nat -A PREROUTING -p tcp -i eth0 -d 192.168.0.195 --dport 7831 -j DNAT --to 192.168.0.195:7831 iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j ACCEPT