Difference between revisions of "Mesh/Exit setup"

Jump to navigation Jump to search
360 bytes added ,  22:12, 26 December 2013
Line 21: Line 21:
case "$1" in
case "$1" in
   start)
   start)
         echo "Starting mesh NAT"
         if [ "`iptables -t nat -L|grep MASQUERADE`" = '' ]; then
        echo 1 > /proc/sys/net/ipv4/ip_forward
                echo "Starting mesh NAT"
        iptables -t nat -A POSTROUTING -o $PUBIF -j MASQUERADE
                echo 1 > /proc/sys/net/ipv4/ip_forward
        iptables -A FORWARD -i $PUBIF -o $BATIF -m state --state RELATED,ESTABLISHED $
                iptables -t nat -A POSTROUTING -o $PUBIF -j MASQUERADE
        iptables -A FORWARD -i $PUBIF -o $BATIF -j DROP
                iptables -A FORWARD -i $PUBIF -o $BATIF -m state --state RELATED,ESTABLISHED -j ACCEPT
                iptables -A FORWARD -i $PUBIF -o $BATIF -j DROP
        else
                echo "Mesh NAT already started"
        fi
         ;;
         ;;
   stop)
   stop)
Line 38: Line 42:
         ;;
         ;;
esac
esac
</pre>
</pre>


Line 47: Line 52:


  if [ `cat /sys/class/net/bat0/operstate` != "up" ]; then
  if [ `cat /sys/class/net/bat0/operstate` != "up" ]; then
        ifup bat0
        ifconfig bat0 <relay_mesh_ip> netmask 255.0.0.0 up
  fi
  fi


Line 53: Line 58:


  if [ `cat /sys/class/net/bat0/operstate` != "up" ]; then
  if [ `cat /sys/class/net/bat0/operstate` != "up" ]; then
        ifup bat0 && /etc/init.d/meshnat start
        ifconfig bat0 <exit_mesh_ip> netmask 255.0.0.0 up
        /etc/init.d/meshnat start
  fi
  fi
Where <exit_mesh_ip> is the assigned mesh IP address for your exit node. E.g: 10.42.0.1.


Now NAT should be set up correctly.
Now NAT should be set up correctly.

Navigation menu