Rev | Line | |
---|
[e829fd8] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # set IP MASQUERADE with post-up command in INTERFACES(5) |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | set -x |
---|
| 7 | |
---|
| 8 | ## INTERFACES(5) |
---|
| 9 | # IFACE physical name of the interface being processed |
---|
[b9ae53a] | 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. |
---|
[e829fd8] | 14 | |
---|
| 15 | # optional argument to set default gateway devices connected to WAN manually |
---|
| 16 | # (try each of them in order) |
---|
| 17 | |
---|
| 18 | if [ "${PHASE}" = "post-down" ]; then |
---|
| 19 | # remove MASQUERADE rule and exit |
---|
| 20 | /sbin/iptables -t nat -D POSTROUTING -o ${IFACE} -j MASQUERADE |
---|
| 21 | exit |
---|
| 22 | fi |
---|
| 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.