source: lab.git/iptables/setmasq.sh @ 4280ad5

trunk
Last change on this file since 4280ad5 was b9ae53a, checked in by mitty <mitty@…>, 15 years ago
  • CR+LF -> LF

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@20 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100755
File size: 735 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.