Skip to contentSkip to conversation

Fix QEMU networking access to WAN

PATCH Applied Scott Garman 2 participants 3 messages Apr 25, 2012 – Apr 27, 2012

lore
Share & tools
lore
#0 lore raw

cover Fix QEMU networking access to WAN

Hello,

This fixes the IP masquerading settings so that networked QEMU sessions can reach external networks.

It is a partial fix for [YOCTO #2329].

It's been tested on my Linux Mint 12 host as well as Saul's Fedora 16 and Ubuntu 11.04 hosts.

Scott

The following changes since commit fd989e1bceef6df36619ba8944c8141abefd282e:

self-hosted-image: Update poky revision to point at the 1.2 release branch (2012-04-24 10:20:25 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib sgarman/runqemu-net-fix-oe
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-net-fix-oe

Scott Garman (1):
runqemu-ifup: enable ip masquerading for QEMU NAT addresses

 scripts/runqemu-ifup |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 runqemu-ifup: enable ip masquerading for QEMU NAT addresses

Fix the IP masquerading settings so that networked QEMU sessions can reach external networks.

This is a partial fix for [YOCTO #2329].

---
 scripts/runqemu-ifup |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/runqemu-ifup +2 -1
index 3bd9980..f80538f 100755
@@ -100,7 +100,8 @@ dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
 $ROUTE add -host 192.168.7.$dest $TAP
 
 # setup NAT for tap0 interface to have internet access in QEMU
-$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
 echo 1 > /proc/sys/net/ipv4/ip_forward
 $IPTABLES -P FORWARD ACCEPT
 
Signature · 1 line
1.7.5.4
Applied
#2 lore raw

Re: [PATCH 1/1] runqemu-ifup: enable ip masquerading for QEMU NAT addresses

Quoted 15 lines · Scott Garman

Fix the IP masquerading settings so that networked QEMU sessions can reach external networks.

This is a partial fix for [YOCTO #2329].

---
  scripts/runqemu-ifup |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
scripts/runqemu-ifup +0 -0
index 3bd9980..f80538f 100755

scripts/runqemu-ifup dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] · line 107

Quoted 9 lines
scripts/runqemu-ifup +2 -1
@@ -100,7 +100,8 @@ dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
  $ROUTE add -host 192.168.7.$dest $TAP
 
  # setup NAT for tap0 interface to have internet access in QEMU
-$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
  echo 1>  /proc/sys/net/ipv4/ip_forward
  $IPTABLES -P FORWARD ACCEPT
 

Merged into OE-Core

Thanks
Sau!