1#!/bin/sh
2#
3# /etc/init.d/rcS
4#
5
6echo -n "mounting swap..."
7/sbin/swapon /dev/hdc
8echo "done."
9
10echo -n "setting up network..."
11/sbin/ifconfig lo 127.0.0.1
12/sbin/ifconfig eth0 192.168.0.1 txqueuelen 1000
13
14echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
15echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
16echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
17echo "0" > /proc/sys/net/ipv4/tcp_timestamps
18echo "0" > /proc/sys/net/ipv4/tcp_sack
19echo "15" > /proc/sys/net/ipv4/tcp_fin_timeout
20echo "16384" > /proc/sys/net/ipv4/tcp_max_syn_backlog
21echo "262144" > /proc/sys/net/ipv4/ip_conntrack_max
22echo "1024 65535" > /proc/sys/net/ipv4/ip_local_port_range
23echo "524287" > /proc/sys/net/core/optmem_max
24echo "300000" > /proc/sys/net/core/netdev_max_backlog
25echo "131072" > /proc/sys/fs/file-max
26echo "10" > /proc/sys/vm/dirty_writeback_centisecs
27echo "done."
28
29# specific for iscsi-target
30MEM_SIZE=1048576
31echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
32echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
33echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
34echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
35echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
36echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
37echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
38
39mke2fs -F /dev/sda
40
41cat > /etc/ietd.conf <<EOF
42Target iqn.2005-05.1.0.168.192
43	Lun 0 Sectors=8000000,Type=nullio
44EOF
45
46/sbin/insmod /modules/iscsi_trgt.ko
47
48echo -n "start enterprise target..."
49/iscsi/ietd -f &
50echo "done."
51
52sleep 3
53
54echo "notifying client..."
55echo "server ready" | netcat -c 192.168.0.10 8000
56echo "done"
57
58echo "starting bash shell..."
59/bin/bash
60