summaryrefslogtreecommitdiff
path: root/ipmasq/rules/M70masq.def
blob: 8c75509732019b8cf5e78bcccfc972da4a6b301f (plain)
  1. # You should not edit this file. Instead, create a file with the same
  2. # name as this one, but with a .rul extension instead of .def. The
  3. # .rul file will override this one.
  4. #
  5. # However, any changes you make to this file will be preserved.
  6. #: Masquerade packets from internal networks
  7. if [ -n "$INTERNAL" -a -n "$EXTERNAL" ]; then
  8. for j in $EXTERNAL; do
  9. for i in $INTERNAL; do
  10. ipnm_cache $i
  11. case $MASQMETHOD in
  12. ipfwadm)
  13. $IPFWADM -F -a masq -W ${j%%:*} -S $IPOFIF/$NMOFIF
  14. ;;
  15. ipchains)
  16. if [ -n "$PEEROFIF" ]; then
  17. $IPCHAINS --no-warnings -A forward -j MASQ -i ${j%%:*} -s $PEEROFIF/$NMOFIF
  18. else
  19. $IPCHAINS --no-warnings -A forward -j MASQ -i ${j%%:*} -s $IPOFIF/$NMOFIF
  20. fi
  21. ;;
  22. netfilter)
  23. i=$(echo $i | cut -d ":" -f 1)
  24. j=$(echo $j | cut -d ":" -f 1)
  25. if [ -n "$PEEROFIF" ]; then
  26. $IPTABLES -t nat -A POSTROUTING -s $PEEROFIF/$NMOFIF -o ${j%%:*} -j MASQUERADE
  27. $IPTABLES -A FORWARD -i $i -o ${j%%:*} -s $PEEROFIF/$NMOFIF -j ACCEPT
  28. $IPTABLES -A FORWARD -o $i -i ${j%%:*} -d $PEEROFIF/$NMOFIF -j ACCEPT
  29. else
  30. $IPTABLES -t nat -A POSTROUTING -s $IPOFIF/$NMOFIF -o ${j%%:*} -j MASQUERADE
  31. $IPTABLES -A FORWARD -i $i -o ${j%%:*} -s $IPOFIF/$NMOFIF -j ACCEPT
  32. $IPTABLES -A FORWARD -o $i -i ${j%%:*} -d $IPOFIF/$NMOFIF -j ACCEPT
  33. fi
  34. ;;
  35. esac
  36. done
  37. done
  38. fi