diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu-ifup | 15 |
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 | ||
92 | n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 92 | n=$[ (`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 |
94 | STATUS=$? | ||
95 | if [ $STATUS -ne 0 ]; then | ||
96 | echo "Failed to set up IP addressing on $TAP" | ||
97 | exit 1 | ||
98 | fi | ||
94 | $IFCONFIG link set dev $TAP up | 99 | $IFCONFIG link set dev $TAP up |
100 | STATUS=$? | ||
101 | if [ $STATUS -ne 0 ]; then | ||
102 | echo "Failed to bring up $TAP" | ||
103 | exit 1 | ||
104 | fi | ||
95 | 105 | ||
96 | dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] | 106 | dest=$[ (`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 |
108 | STATUS=$? | ||
109 | if [ $STATUS -ne 0 ]; then | ||
110 | echo "Failed to add route to 192.168.7.$dest using $TAP" | ||
111 | exit 1 | ||
112 | fi | ||
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 |