summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-ifup
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu-ifup')
-rwxr-xr-xscripts/runqemu-ifup15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/runqemu-ifup b/scripts/runqemu-ifup
index b5a3db964b..d9bd894123 100755
--- a/scripts/runqemu-ifup
+++ b/scripts/runqemu-ifup
@@ -91,10 +91,25 @@ fi
91 91
92n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] 92n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
93$IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP 93$IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP
94STATUS=$?
95if [ $STATUS -ne 0 ]; then
96 echo "Failed to set up IP addressing on $TAP"
97 exit 1
98fi
94$IFCONFIG link set dev $TAP up 99$IFCONFIG link set dev $TAP up
100STATUS=$?
101if [ $STATUS -ne 0 ]; then
102 echo "Failed to bring up $TAP"
103 exit 1
104fi
95 105
96dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] 106dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
97$IFCONFIG route add to 192.168.7.$dest dev $TAP 107$IFCONFIG route add to 192.168.7.$dest dev $TAP
108STATUS=$?
109if [ $STATUS -ne 0 ]; then
110 echo "Failed to add route to 192.168.7.$dest using $TAP"
111 exit 1
112fi
98 113
99# setup NAT for tap0 interface to have internet access in QEMU 114# setup NAT for tap0 interface to have internet access in QEMU
100$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 115$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32