Skip to contentSkip to conversation

usermode-networking problem

Qemu-devel Adrian Smarzewski 5 participants 7 messages May 23, 2004 – Jun 3, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

QEmu 2.5.5 with usermode-networking compiled and turned on. Internet connection on host system (linux 2.6) works. on guest system (linux-test):

sh-2.05b# ping -c 3 10.0.2.2
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data. 64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=3.16 ms 64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.390 ms 64 bytes from 10.0.2.2: icmp_seq=3 ttl=255 time=0.333 ms

sh-2.05b# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface

10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

sh-2.05b# ping -c 3 212.77.100.101
PING 212.77.100.101 (212.77.100.101) 56(84) bytes of data.

--- 212.77.100.101 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2018ms

I don't know why. Should I configure something on host os?

Signature · 2 lines
Pozdrowienia
Adrian Smarzewski
#1 lore raw
Quoted 5 lines · Adrian Smarzewski

QEmu 2.5.5 with usermode-networking compiled and turned on. Internet connection on host system (linux 2.6) works. on guest system (linux-test):

I don't know why. Should I configure something on host os?

Have you tried with your firewall totally opened ? (iptables -P INPUT/OUPUT ACCEPT and ADSL unplugged of course)

#2 lore raw
In reply to Adrian Smarzewski
Quoted 8 lines · Adrian Smarzewski

sh-2.05b# ping -c 3 212.77.100.101
PING 212.77.100.101 (212.77.100.101) 56(84) bytes of data.

--- 212.77.100.101 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2018ms

I don't know why. Should I configure something on host os?

Yes: On your host you have to:

1. Enable IP forwarding:

# echo 1 > /proc/sys/net/ipv4/ip_forward

2. Enable masquerading

# iptables -t nat -A POSTROUTING	\
	-s 10.0.0.0/8			\
	-d ! 10.0.0.0/8 -j MASQUERADE

C

#3 lore raw
Quoted 11 lines · Carlos Valiente

Yes: On your host you have to:

1. Enable IP forwarding:

# echo 1 > /proc/sys/net/ipv4/ip_forward

2. Enable masquerading

# iptables -t nat -A POSTROUTING	\
	-s 10.0.0.0/8			\
	-d ! 10.0.0.0/8 -j MASQUERADE

doesn't work for me :(

root@thunder root # cat /proc/sys/net/ipv4/ip_forward 1

root@thunder root # ifconfig
<...>
eth1 Link encap:Ethernet HWaddr 00:02:44:3C:06:53

          inet addr:112.2.2.17  Bcast:112.2.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18610 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13040 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10535515 (10.0 Mb)  TX bytes:1478199 (1.4 Mb)
          Interrupt:11 Base address:0xee00

<...>

root@thunder root # route -n
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
112.2.2.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1

<...>
0.0.0.0 112.2.2.11 0.0.0.0 UG 0 0 0 eth1

dhcp on 10.0.2.2 and dns on 10.0.2.3 are working.

Signature · 2 lines
Pozdrowienia
Adrian Smarzewski
#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adrian Smarzewski wrote:
| doesn't work for me :(
no ideas?

- --
Pozdrowienia
Adrian Smarzewski
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAvvxMgnuWEmthbpURAjIjAJwPBGAVuh3XI1MAE4RiyCdr1H9WTwCfSdTZ pK/LMNgzx/ErYx34Xn976+g=
=uklp
-----END PGP SIGNATURE-----

#5 lore raw
In reply to Carlos Valiente
Quoted 13 lines · Carlos Valiente
Quoted 8 lines · Adrian Smarzewski

sh-2.05b# ping -c 3 212.77.100.101
PING 212.77.100.101 (212.77.100.101) 56(84) bytes of data.

--- 212.77.100.101 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2018ms

I don't know why. Should I configure something on host os?

Yes: On your host you have to:

1. Enable IP forwarding:

[...]

Quoted 1 line

2. Enable masquerading

[...]

Not sure but I thought that the purpose of the the -user-net feature was to remove the need for any superuser privileges or special host configuration.

From what I understand user-mode networking is quite a feat to pull off, with ICMP (e.g. ping(8)) being probably harder than TCP or UDP due to the interfaces made available by the system to non-superusers. I have not looked at the code but the suggestion has been made that it may even be necessary to fork and exec the (setuid) /usr/ping executable.

I would suspect that, as previously mentioned, UDP is working but the connection tracking of the TCP implementation is broken/incomplete in some way.

#6 lore raw
In reply to Adrian Smarzewski

Hi,

ping is _not_ supported reliably in user mode network except to ping the local router.

Fabrice.

Quoted 30 lines · Adrian Smarzewski

Hi,

QEmu 2.5.5 with usermode-networking compiled and turned on. Internet connection on host system (linux 2.6) works. on guest system (linux-test):

sh-2.05b# ping -c 3 10.0.2.2
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data. 64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=3.16 ms 64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.390 ms 64 bytes from 10.0.2.2: icmp_seq=3 ttl=255 time=0.333 ms

sh-2.05b# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface

10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

sh-2.05b# ping -c 3 212.77.100.101
PING 212.77.100.101 (212.77.100.101) 56(84) bytes of data.

--- 212.77.100.101 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2018ms

I don't know why. Should I configure something on host os?