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

  • Care este reactia ta?
  • powered by Verysign
  • like GNU/Linux.ro
    Like
  • unmoved GNU/Linux.ro
    unmoved
  • amused GNU/Linux.ro
    amused
  • excited GNU/Linux.ro
    excited
  • angry GNU/Linux.ro
    angry
  • sad GNU/Linux.ro
    sad
TENDINTA  |  Tutorial configurarea unui depozit Yum local pe CentOS 7
Andreea                   GNU/Linux.ro
Andreea
"Rome wasn't built in a day" !
82 articole



  • Comenteaza
  • powered by Verysign

Nici un comentariu inca. Fii primul!