[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Mixed network environment - using LTSP server for routing too



Hamlesh [Personal] wrote:
Neither worked :(

"service nat restart" yields: "nat: unrecognized service"

enabling ipv4 forwarding doesnt seem to route the traffic.

Any other ideas?

That means you didn't use the K12LTSP distro that installs a lot of nice stuff for you.

Below is the 'nat' init script. Change the PUBLIC_ETHERNET interface at the top if needed and fix any wrapped lines.



#!/bin/sh
#
#
#
# Version:      0.0.3
#
# chkconfig: 2345 90 10
# description: Starts and stops Network Address Translation for 12Linux/LTS
#

PUBLIC_ETHERNET="eth1"

# Source function library.
. /etc/init.d/functions

start() {
        echo -n "Starting up Network Address Translation: "
        # Load the NAT module (this pulls in all the others).
        modprobe iptable_nat

        # In the NAT table (-t nat), Append a rule (-A) after routing
# (POSTROUTING) for all packets going out eth1 (-o eth1) which says to
        # MASQUERADE the connection (-j MASQUERADE).
        iptables -t nat -A POSTROUTING -o $PUBLIC_ETHERNET -j MASQUERADE

        # Turn on IP forwarding
        echo 1 > /proc/sys/net/ipv4/ip_forward

        echo
        return 0
}
stop() {
        echo -n "Stopping Network Address Translation: "
        echo 0 > /proc/sys/net/ipv4/ip_forward
        iptables -t nat -D POSTROUTING -o $PUBLIC_ETHERNET -j MASQUERADE
        echo
        return 0
}

restart() {
            stop
            start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        restart
        ;;
  *)
        echo "*** Usage: nat {start|stop|restart}"
        exit 1
esac

#####


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]