debuggers.hg

view tools/misc/enable_nat @ 673:8463f8865ddc

bitkeeper revision 1.352.1.1 (3f13d81eTRR1ajDAiyPHK9scX5CJAQ)

Add NAT utility script for use in domain 0 when you only have one real IP.
author rac61@labyrinth.cl.cam.ac.uk
date Tue Jul 15 10:31:58 2003 +0000 (2003-07-15)
parents
children 062359854730
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:0 169.254.1.0 up
10 run_iptables -t filter -F
11 run_iptables -t nat -F
12 run_iptables -t filter -X
13 run_iptables -t nat -X
14 run_iptables -t filter -P FORWARD DROP
15 run_iptables -t filter -A FORWARD -i eth0 -o eth0 -s 169.254.0.0/16 -j ACCEPT
16 run_iptables -t filter -A FORWARD -i eth0 -o eth0 -d 169.254.0.0/16 -m state --state ESTABLISHED,RELATED -j ACCEPT
17 run_iptables -t nat -A POSTROUTING -o eth0 -s 169.254.1.0 -j RETURN
18 run_iptables -t nat -A POSTROUTING -o eth0 -s 169.254.0.0/16 -j MASQUERADE
19 echo 1 > /proc/sys/net/ipv4/ip_forward