rendered paste body#!/sbin/runscript
#######################################################################################
### Network Address Translation Initialization Script ###
#######################################################################################
start() {
ebegin "Setting up network address translation tables"
###############################################################################
###############################################################################
############################### Initialization ################################
###############################################################################
###############################################################################
iptables -t nat -F ### Flush Nat Tables
iptables -t mangle -F ### Flush Mangle Tables
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
#iptables -t nat -A POSTROUTING -m mark --mark 1 -s 192.168.0.0/24 -j MASQUERADE ### Masqueraded NAT for LAN
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
############################### Trusted Access ################################
###############################################################################
###############################################################################
#iptables -t mangle -A PREROUTING -m mac --mac-source 00:13:10:6D:8B:01 -j MARK --set-mark 1 ### Linksys Router
###############################################################################
###############################################################################
############################### Destination NAT ###############################
###############################################################################
###############################################################################
#iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 6800:7000 -j DNAT --to-destination 192.168.0.100 ### BitTorrent Port
#iptables -t nat -A PREROUTING -i eth0 -p udp --dport 6800:7000 -j DNAT --to-destination 192.168.0.100 ### BitTorrent Port
###############################################################################
###############################################################################
###############################################################################
###############################################################################
###############################################################################
eend $?
}
stop() {
ebegin "Clearing network address translation tables"
iptables -t nat -F
iptables -t mangle -F
eend $?
}