ia64/xen-unstable

view tools/misc/xen_nat_enable @ 737:21edd206e08a

bitkeeper revision 1.438 (3f6b0484BZy2LGiiikzVk37DQ8Lyhg)

make xen_nat_enable work even if you don't have a supported Ethernet card
author iap10@labyrinth.cl.cam.ac.uk
date Fri Sep 19 13:28:36 2003 +0000 (2003-09-19)
parents 7192aa19b83c
children 9ccd60698e09
line source
1 #!/bin/sh
3 run_iptables() {
4 if ! iptables $@ ; then
5 echo "iptables returned error; have you built netfilter?"; exit 1
6 fi
7 }
9 ifconfig eth0 up
10 ifconfig eth0:0 169.254.1.0 up
12 run_iptables -t filter -F
13 run_iptables -t nat -F
14 run_iptables -t filter -X
15 run_iptables -t nat -X
16 run_iptables -t filter -P FORWARD DROP
17 run_iptables -t filter -A FORWARD -i eth0 -o eth0 -s 169.254.0.0/16 -j ACCEPT
18 run_iptables -t filter -A FORWARD -i eth0 -o eth0 -d 169.254.0.0/16 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
19 run_iptables -t nat -A POSTROUTING -o eth0 -s 169.254.1.0 -j RETURN
20 run_iptables -t nat -A POSTROUTING -o eth0 -s 169.254.0.0/16 -j MASQUERADE
21 echo 1 > /proc/sys/net/ipv4/ip_forward
23 #set up some port redirects for ssh
24 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2201 -j DNAT --to 169.254.1.1:22
25 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2202 -j DNAT --to 169.254.1.2:22
26 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2203 -j DNAT --to 169.254.1.3:22
27 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2204 -j DNAT --to 169.254.1.4:22
28 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2205 -j DNAT --to 169.254.1.5:22
29 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2206 -j DNAT --to 169.254.1.6:22
30 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2207 -j DNAT --to 169.254.1.7:22
31 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2208 -j DNAT --to 169.254.1.8:22
32 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2209 -j DNAT --to 169.254.1.9:22
33 run_iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2210 -j DNAT --to 169.254.1.10:22