gem5/configs/boot/natbox-spec-surge.rcS
Lisa Hsu 182425da82 add support for NAT under netperf stream, maerts, and spec-surge.
configs/boot/spec-surge-client.rcS:
configs/boot/surge-client.rcS:
    fix this rcS - don't sleep, instead wait for the server to tell you it's done.
configs/boot/spec-surge-server.rcS:
configs/boot/surge-server.rcS:
    notify the client you're done starting the server.

--HG--
extra : convert_revision : b708bd0a9147e248eed7c27e7078668fbd98b95e
2004-11-16 22:43:12 -05:00

51 lines
1.4 KiB
Bash

#!/bin/sh
EXTIF=192.168.0.7
INTIF=10.0.0.1
CLIENT=10.0.0.2
echo "setting up network..."
ifconfig lo 127.0.0.1
ifconfig eth0 $EXTIF txqueuelen 1000
ifconfig eth1 $INTIF txqueuelen 1000
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
echo "0" > /proc/sys/net/ipv4/tcp_sack
echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_rmem
echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_wmem
echo "5000000 5000000 5000000" > /proc/sys/net/ipv4/tcp_mem
echo "262143" > /proc/sys/net/core/rmem_max
echo "262143" > /proc/sys/net/core/wmem_max
echo "262143" > /proc/sys/net/core/rmem_default
echo "262143" > /proc/sys/net/core/wmem_default
echo "262143" > /proc/sys/net/core/optmem_max
echo "100000" > /proc/sys/net/core/netdev_max_backlog
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "waiting for netserver..."
/usr/bin/netcat -c -l -p 8000
echo "setting up iptables..."
IPTABLES=/sbin/iptables
EXTIF=eth0
INTIF=eth1
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
echo "informing client..."
echo "server ready" | /usr/bin/netcat -c $CLIENT 8000
echo "starting bash..."
exec /bin/bash