02.08.2013 Views

Linux IP Masquerade HOWTO - The Linux Documentation Project

Linux IP Masquerade HOWTO - The Linux Documentation Project

Linux IP Masquerade HOWTO - The Linux Documentation Project

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

# Source function library.<br />

. /etc/rc.d/init.d/functions<br />

# Check that networking is up.<br />

[ "XXXX${NETWORKING}" = "XXXXno" ] && exit 0<br />

[ −x /sbin/ifconfig ] || exit 0<br />

# <strong>The</strong> location of various iptables and other shell programs<br />

#<br />

# If your <strong>Linux</strong> distribution came with a copy of iptables, most<br />

# likely it is located in /sbin. If you manually compiled<br />

# iptables, the default location is in /usr/local/sbin<br />

#<br />

# ** Please use the "whereis iptables" command to figure out<br />

# ** where your copy is and change the path below to reflect<br />

# ** your setup<br />

#<br />

<strong>IP</strong>TABLES=/usr/local/sbin/iptables<br />

# See how we were called.<br />

case "$1" in<br />

start)<br />

/etc/rc.d/rc.firewall−iptables<br />

;;<br />

stop)<br />

echo −e "\nFlushing firewall and setting default policies to DROP\n"<br />

$<strong>IP</strong>TABLES −P INPUT DROP<br />

$<strong>IP</strong>TABLES −F INPUT<br />

$<strong>IP</strong>TABLES −P OUTPUT DROP<br />

$<strong>IP</strong>TABLES −F OUTPUT<br />

$<strong>IP</strong>TABLES −P FORWARD DROP<br />

$<strong>IP</strong>TABLES −F FORWARD<br />

$<strong>IP</strong>TABLES −F −t nat<br />

# Delete all User−specified chains<br />

$<strong>IP</strong>TABLES −X<br />

#<br />

# Reset all <strong>IP</strong>TABLES counters<br />

$<strong>IP</strong>TABLES −Z<br />

;;<br />

restart)<br />

$0 stop<br />

$0 start<br />

;;<br />

status)<br />

$<strong>IP</strong>TABLES −L<br />

;;<br />

mlist)<br />

cat /proc/net/ip_conntrack<br />

;;<br />

*)<br />

<strong>Linux</strong> <strong>IP</strong> <strong>Masquerade</strong> <strong>HOWTO</strong><br />

echo "Usage: firewall−iptables {start|stop|status|mlist}"<br />

Chapter 3. Setting Up <strong>IP</strong> <strong>Masquerade</strong> 43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!