Qemu networking Again?!
Just want to find out how you everyone did it. Here's my setup. I setup qemu and my host OS is Ubuntu Linux while my Guest is Windows 2000.
I have two ethernet cards with the following IP addresses:
eth0 22.214.171.124 (Static IP provided by my ISP)
eth1 192.168.0.201 (local address)
I want to enable both of these connections on my guest OS. I tried to read infos from the forum but its just too complicated to a newbie like me.
Is it possible to use both of my connection in my guest OS? If so, how will I be able to achieve it? Secondly, is it possible to share files within the host and guest OS? I will need to do programming on the guest OS and transfer it to the server or at least in the host OS. But I can't seem to make it work. Third, can qemu guest os use the modem to dial-up? Everyones might be busy nowadays but I'll be grateful if someone will help me on this. Thanks.
Okay, I'll go ahead and try for two out of three (maybe 2 1/2).
First. I'm assuming the eth0 and eth1 you mentioned are hostOS NICs. Getting the guest OS to use these is a breeze. You'll want to employ the "-net tap" option. The exact specifics of doing so are available in the man page however I will suggest a snippet that comes without even the slightest implication of usability.
Now, from there just to give you a heads up, qemu will expect an executable file in the /etc directory named `qemu-ifup` to be present. If what you have explained here is the sum total of your Qemu networking, the contents of the qemu-ifup file may look something like this:
We are almost there my friend (this sounds like a lot but it's really 15-20 minutes worth of "work"). There are many different ways to do this next part but I'll tell yo uwaht I think is best (since you asked). The tun module will create a dynamic device called /dev/net/tun which qemu will need access to to create the device. for this reason most people say run qemu sudoed 'cause root has access to everything. NOT A BIG FAN OF THIS IDEA. What I did instead was edit the /etc/udev/rules.d/udev.rules to dynamically assign ownership of /dev/net/tun to Owner:root Group:net. Then I just created the net group and added myself to it. Also, /etc/qemu.ifup should have the same ownership levels. Knock out these three things and you SHOULD (no warranties!!) have what it is you're looking for. It's really not as complicated as it looks (20 minutes TOPS).
For sharing files between guest and host OS' there of course is the -smb option which requires you to have smb installed on the host OS. Again, not my preferred option. What I do instead when moving files back and forth is just scp them. 10.0.2.2 is the host os and you can scp (on a host only connection) from your guest os to your host OS no problem. Your max DTR is about 200k-300k so for larger files beprepared to wait a while BUT that has nothing to do with the scp option. If for some strange reason you prefer scp'ing from the host to the guest over vice versa, you can use the -redir option to allow connections in that direction.
That's my promised two out of three, now as far as the modem thing is concerned, who the heck still has a modem?? J/K I know a few thrid world countries still use them regularly (potable water first, then high speed internet). The bridging trick from the first answer should work once the modem is establed on ppp0 or whatever interface it's going to be. Now I know I said the other stuff isn't guarenteed to work, but this really isn't as this is something I've never actually done buffer (just shooting from the hip). Good luck.
P.S. Just to recap in case you got lost, you will need:
Qemu Flag: -net nic -net tap
Kernel Module: bridge.ko tun.ko
Permissions: /etc/demu-ifup /dev/net/tun
Software: scp, WinSCP
[everything from 1)]
THanks man...I am grateful someone like you is patient enough to teach a newbie. I'll do this tomorrow and I'll give you updates.
I did eveything as instructed. if I run:
qemu -net nic,macaddr=00:80:AD:85:A5:B0 -net tap,iface=tap0 \
-net nic,macaddr=00:01:03:03:FA:7E -net tap,iface=tap1 -hda /home/don/myos as instructed, I get
warning: could not open /dev/net/tun: no virtual network emulation
Could not initialize device 'tap'
I did everything you told me but it just can't seem to work.. Hope you can help me on this.
Well, you've got a pretty specific error message there so I would say troubleshooting this shouldn't be too difficult.
"warning: could not open /dev/net/tun:" tells me that /dev/net/tun doesn't exist or your user doesn't have rights to the file. If /dev/net/tun doesn't exist then the tun.ko module isn't loading.
If it does exist and you just don't have permission to use it you have several options to rememdey the situation:
1) chmod/chown: This will fix it until next reboot.
2) sudo: This will have qemu run as root (NOT RECOMMENDED).
3) /etc/udev/rules.d/udev.rules && /etc/group: This is the fix that I recommended in my first post. It is permanent and more secure than option 2).
I'd be very surprised to hear that either of the situations above wasn't the root cause of your current issues but if so, post back and maybe someone a little bit brighter than myself can shed some light on the subject.
How can I configure the tap device? I have tried configuring tun with modprobe tun and the command tunctl -u 'user' -t tun0. Does it mean I also have to issue a command:
tunctl -u 'user' -t tap0
tunctl -u 'user' -t tap1
I've also read in some howtos that you can issue a command:
Does the script you posted automatically configures the IP of the tap device?
Should I specify a different IP from my ethernet cards?
Okay, here's what I want to do:
1.) I want to retain my host IP with my guest OS. In such a way that I can ping other workstations as if I'm just running on my host OS.
2.) Configure file sharing from host os,guest os, and other networks with the use of samba.
Forgive me for my ignorance, I'm just a newbie and hope you can help me out on this one. Thanks. I'm glad you're helping me out.
More on qemu and networking
I were able to activate my local IP 192.168.0.201 as if it is connected on my guest OS. Thanks to you. Some comments, I wasn't able to get my exact 192.168.0.201 address on my guest OS. It gave me another IP address (192.168.0.129) though. My problem is that the IP 126.96.36.199 did not reflect on my guest OS. Any ideas on how to activate it? I also can't ping 192.168.0.201 (IP address of my host OS). I will try to use scp to transfer files from host to guest and vice versa. HOw about USB plug and play? Does qemu support for USB plug and play in Windows 2K? Thanks.
|All times are GMT -5. The time now is 09:07 PM.|