source: lab/trunk/iptables/setmasq.sh @ 16

Last change on this file since 16 was 16, checked in by mitty, 15 years ago
  • setlan2wan.sh
  • setmasq.sh
    • replacement for setnapt.sh
  • Property svn:executable set to *
File size: 739 bytes
Line 
1#!/bin/sh
2
3# set IP MASQUERADE with post-up command in INTERFACES(5)
4
5
6set -x
7
8## INTERFACES(5)
9# IFACE  physical name of the interface being processed
10# METHOD method of the interface (e.g., static)
11# MODE   start if run from ifup, stop if run from ifdown
12# PHASE  as per MODE, but with finer granularity, distinguishing the pre-
13#        up, post-up, pre-down and post-down phases.
14
15# optional argument to set default gateway devices connected to WAN manually
16# (try each of them in order)
17
18if [ "${PHASE}" = "post-down" ]; then
19    # remove MASQUERADE rule and exit
20    /sbin/iptables -t nat -D POSTROUTING -o ${IFACE} -j MASQUERADE
21    exit
22fi
23
24
25# set MASQUERADE rule
26/sbin/iptables -t nat -A POSTROUTING -o ${IFACE} -j MASQUERADE
Note: See TracBrowser for help on using the repository browser.