You are not logged in.

#1 2006-01-30 19:39:48

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

qemu networking - what's the secret?

Yesterday I installed qemu with kqemu, and Win98 as the guest OS. Everything went as described in the wiki page and other docs, and it boots with no problems. W98 gets ip address 10.0.2.15, and I can access the host i.e. Arch on 10.0.2.2. However, as I understand it, this default setup should also give W98 internet access, but it doesn't. sad

Now before I go messing with tun/tap and the qemu-ifup script, can anyone tell me anything about this? Should the guest be networked by default? Have I missed something? :?

Offline

#2 2006-01-30 20:42:26

lessthanjake
Member
From: Norway
Registered: 2005-11-09
Posts: 319
Website

Re: qemu networking - what's the secret?

You do not need to mess with tun, just use the -user-net option.

Offline

#3 2006-01-30 20:52:41

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: qemu networking - what's the secret?

tomk wrote:

Yesterday I installed qemu with kqemu, and Win98 as the guest OS. Everything went as described in the wiki page and other docs, and it boots with no problems. W98 gets ip address 10.0.2.15, and I can access the host i.e. Arch on 10.0.2.2. However, as I understand it, this default setup should also give W98 internet access, but it doesn't. sad

Now before I go messing with tun/tap and the qemu-ifup script, can anyone tell me anything about this? Should the guest be networked by default? Have I missed something? :?

Before I begin: the user-net enabled internet access here without problems, but note that only regular tcp and udp stuff works, so no pings.

Ok, with the tuntap method, you need to know some stuff about networking to make it work.

First, here is my qemu-ifup script:

#!/bin/sh

if [ "$2" = "" ]; then
        sudo "$0" "$1" "x" || exit 1
else
        ifconfig $1 192.168.50.2 up || exit 1
        /etc/rc.d/dhcpd restart || exit 1
fi

Of course, for this to work you have to add a sudo nopasswd rule. You may also need dhcp to be configured properly if you don't want to set W98's network settings manually. Then you have to add a nat rule to enable internet access from the virtual machine:

iptables -t nat -A POSTROUTING -s 192.168.50.0/24 -o ppp0 -j MASQUERADE

assuming ppp0 is your internet interface. Then just enable ip forwarding and you're done:

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

Offline

#4 2006-01-30 22:54:29

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: qemu networking - what's the secret?

Thanks guys. -user-net is fine for the moment, and I may try  tun/tap later. I think the docs need correction though:

From the man page -

       -user-net
           Use the user mode network stack. This is the default if no tun/tap
           network init script is found.

I take that to mean that if no network options are provided, -user-net will be used. That's what "default" means.

Anyway, it's up and running - thanks again for the help. smile

Offline

#5 2006-02-01 15:49:37

fatbird
Member
From: Springboro, PA
Registered: 2005-12-20
Posts: 17

Re: qemu networking - what's the secret?

I also have been trying to get internet access with a W98 guest and -user-net.  I have a home lan with 3 PC's connected to a router that has internet access via a DSL modem.  I can ping 10.0.2.2 but when I try to connect to 192.168.1.1 ( my router's admin page) or 66.249.93.104 (Google) I get "Internet Explorer could not open the search page" .

Have I got something set up wrong or is just not possible to use -user-net thru a router?

Offline

#6 2006-02-01 16:11:54

lessthanjake
Member
From: Norway
Registered: 2005-11-09
Posts: 319
Website

Re: qemu networking - what's the secret?

Maybe there is something wrong with your win98config. You can try a liveLinuxCD and see if it is working then, UbuntuLive works out of the box on QEMU/-user-net. I am using winXP through a router, so that is not the problem.

Offline

#7 2006-02-01 21:01:22

fatbird
Member
From: Springboro, PA
Registered: 2005-12-20
Posts: 17

Re: qemu networking - what's the secret?

I tried UbubtuLive in QEMU and it didn't work.  The network was not configured and eth0 had no IP address.  It ran so painfully slowly that I didn't bother to try to get the network going.

My W98 guest TCP/IP settings are:

IP Address: Obtain an IP address automatically (it gets 10.0.2.15)
Gateway: 10.0.2.2
DNS Configuration: Enable DNS, Host: msi, 10.0.2.3
Bindings: Client for Microsoft Networks
Advanced: Allow Binding to ATM: No

My host linux has:

Hostname: msi
IP address: 192.168.1.2
Gateway: 192.168.1.1

I have a fixed IP address on the DSL line.

Does any of this sound like a problem?  As I understand it the guest IP etc are fixed but if necessary I can change the host settings.

Offline

#8 2006-02-04 00:32:16

fatbird
Member
From: Springboro, PA
Registered: 2005-12-20
Posts: 17

Re: qemu networking - what's the secret?

Update: I think I had a corrupted windows image file.  I had three image files: win.qcow (the original image right after installation of W98), win1.qcow (a copy of win.qcow after installing some software and doing some configuration) and win2.qcow (a copy of win1.qcow on my laptop).

The win1.qcow on my main PC is the one that doesn't work.  I tried qemu on my laptop with win2.qcow and it worked.  I copied win2.qcow back to my main PC and it worked there.  I compared network settings between the two images and everything was the same.  I then ran the network wizard on win.qcow and that worked.  Only win1.qcow doesn't work.

BTW, only the 'IP Address: Obtain an IP address automatically' setting is required.  The MS network wizard left the gateway and  dns settings blank.

Offline

Board footer

Powered by FluxBB