- Timestamp:
- Jul 7, 2009 11:48:58 PM (15 years ago)
- Branches:
- master, trunk
- Children:
- b9ae53a
- Parents:
- 7c270d4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
iptables/setlan2wan.sh
r7c270d4 r3a5184c 13 13 # up, post-up, pre-down and post-down phases. 14 14 15 LANIF="${1:?"usage: $0 <LAN_device> "}" 16 17 LANIP=`/sbin/ip addr show dev ${LANIF} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1` 18 LANMASK=`/sbin/ip route show dev ${LANIF} | grep -w ${LANIP} | tr -s ' ' | cut -d ' ' -f 1` 15 LANIF="${1:?"usage: $0 <LAN_device> <IPADDR> "}" 16 LANIP="${2:?"usage: $0 <LAN_device> <IPADDR> "}" 19 17 20 18 WANIP=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1` … … 22 20 if [ "${PHASE}" = "pre-down" ]; then 23 21 # delete rule and exit 24 /sbin/iptables -t nat -D PREROUTING -i ${LANIF} - s ${LANMASK} -d ${WANIP} -j DNAT --to-destination ${LANIP}22 /sbin/iptables -t nat -D PREROUTING -i ${LANIF} -d ${WANIP} -j DNAT --to-destination ${LANIP} 25 23 echo "remove rule for access to WAN device on router node from LAN clients" 26 24 exit … … 32 30 sleep 60 33 31 34 /sbin/iptables -t nat -A PREROUTING -i ${LANIF} - s ${LANMASK} -d ${WANIP} -j DNAT --to-destination ${LANIP}32 /sbin/iptables -t nat -A PREROUTING -i ${LANIF} -d ${WANIP} -j DNAT --to-destination ${LANIP} 35 33 echo "set rule for access to WAN device on router node from LAN clients" 36 34
Note: See TracChangeset
for help on using the changeset viewer.