natbox-spec-surge.rcS revision 1196:5e20797f314a
1#!/bin/sh 2EXTIF=192.168.0.7 3INTIF=10.0.0.1 4CLIENT=10.0.0.2 5 6echo "setting up network..." 7ifconfig lo 127.0.0.1 8ifconfig eth0 $EXTIF txqueuelen 1000 9ifconfig eth1 $INTIF txqueuelen 1000 10 11echo "0" > /proc/sys/net/ipv4/tcp_timestamps 12echo "0" > /proc/sys/net/ipv4/tcp_sack 13echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_rmem 14echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_wmem 15echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_mem 16echo "262143" > /proc/sys/net/core/rmem_max 17echo "262143" > /proc/sys/net/core/wmem_max 18echo "262143" > /proc/sys/net/core/rmem_default 19echo "262143" > /proc/sys/net/core/wmem_default 20echo "262143" > /proc/sys/net/core/optmem_max 21echo "100000" > /proc/sys/net/core/netdev_max_backlog 22 23echo "1" > /proc/sys/net/ipv4/ip_forward 24 25echo "waiting for netserver..." 26/usr/bin/netcat -c -l -p 8000 27 28echo "setting up iptables..." 29IPTABLES=/sbin/iptables 30EXTIF=eth0 31INTIF=eth1 32 33$IPTABLES -P INPUT ACCEPT 34$IPTABLES -F INPUT 35$IPTABLES -P OUTPUT ACCEPT 36$IPTABLES -F OUTPUT 37$IPTABLES -P FORWARD DROP 38$IPTABLES -F FORWARD 39$IPTABLES -t nat -F 40 41$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT 42$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT 43$IPTABLES -A FORWARD -j LOG 44 45$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE 46 47echo "informing client..." 48echo "server ready" | /usr/bin/netcat -c $CLIENT 8000 49 50echo "starting bash..." 51exec /bin/bash 52