SNAT pentru IP dinamic folosind iptables - PPPoE sau DHCP

#!/bin/sh
WANIF="ppp0"
LANIF="eth0"
INTERNALNET="192.168.0.0/24"
IFCONFIG=/sbin/ifconfig
IPTABLES=/usr/sbin/iptables
GREP=/bin/grep
AWK=/bin/awk

Determinam adresa IP externa automat:

WANIP="`$IFCONFIG $WANIF | $GREP 'inet addr' | $AWK '{print $2}' | sed -e 's/.*://'`"

Se face SNAT la toate IP-urile din reteaua locala prin IP-ul extern

$IPTABLES -t nat -A POSTROUTING -s $INTERNALNET -j SNAT --to $WANIP

Gata

Trimite-ne o stire
  • What is your reaction?
  • powered by Verysign
  • like gnulinux.ro
    Like
  • unmoved gnulinux.ro
    Unmoved
  • amused gnulinux.ro
    Amused
  • excited gnulinux.ro
    Excited
  • angry gnulinux.ro
    Angry
  • sad gnulinux.ro
    Sad
TENDINTA  |  GParted Live 1.1.0-3 Release Stable
Andreea                   gnulinux.ro
Andreea
"Rome wasn't built in a day" !
116 articole



  • Comenteaza
  • powered by Verysign

Nici un comentariu inca. Fii primul!