LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 06-09-2012, 02:40 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Networking broke for QEMU


I haven't used networking in QEMU virtual machines for perhaps about a year. Today I need to run stuff in a VM and have it make a TCP connection to outside and it's not working. The options for QEMU have not changed since it worked before. The guest OS configuration looks right for running inside QEMU (10.0.2.15 as the guest IP address and 10.0.2.2 as the route gateway). I am using the "-net nic -net user" options on the QEMU command line, as coded in the script I've used for starting QEMU for over 3 years.

I have even done Ubuntu updates from inside QEMU before, so I know the networking worked for Ubuntu as the guest. I've also had Slackware doing networking as a guest before.

I never did understand just how QEMU makes this work. I suspect it has some kind of NAT+DHCPD running inside the emulator. So I don't really know what to look for to see why it isn't working. Outside QEMU I see no traffic at all for what I'm doing. I suspect it is something changed in the host QEMU is running on, but I have no idea what QEMU needs for this.

I might just go ahead and change the networking method over to another where the guest packets are literally forwarded, since this method "makes sense" and allows using the usual debugging. This would require more privilege to set up, which I'd rather avoid. But before doing that I do want to spend some time to find out what broke. And for that I believe it needs to be based on knowledge of how this kind of networking fakery is done.

Any ideas what I should look for?

PS: It might have been working a few days ago, too. I did an install of Xubuntu 12.04 and during the install it reported there was network access for updates during install. I didn't choose that as I never do. But I think it has checked more than just if a local network is configured. I think I'll try doing that install again.

Still looking for a document that describes just what QEMU does with this kind of network setup. The QEMU manual doesn't say much beyond how to use it, and as far as I can tell from the manual, it should work for TCP to anywhere as long as there is a route to 10.0.2.2 in the guest network config (there is). I can ping 10.0.2.2. I cannot TCP to 10.0.2.2 so I think maybe it's the part that picks up TCP packets and makes new host process connections from them that is failing.

Last edited by Skaperen; 06-09-2012 at 03:22 PM.
 
Old 06-09-2012, 03:47 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Qemu and almost all vm's offer a virtual router as part of the virtual machine application. This is the IP ranges you see. You have used dhcp in qemu to just get what it offers and they tend to call this NAT as opposed to bridged or local.

Ping is a poor choice to start with.

This page may answer all your questions. http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html even though it is for windows port.

We may need to know the version you have and the host OS and settings. From the host it should see a virtual nic of sorts and the host ought to allow it to connect.


The old qemu ballard pages were better. I think you can get that also by running qemu with no options. It should list the read me.

Last edited by jefro; 06-09-2012 at 03:50 PM.
 
Old 06-09-2012, 04:42 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
I have the QEMU manual and it's basically the same thing as the linked page. It's telling overall usage concepts, and usage options. Nothing tells me what to look for if it doesn't work.

Note that ping works. But ping is only supposed to work to 10.0.2.2 (or whatever you reconfigure the virtual gateway to be). TCP, even to 10.0.2.2 does not work.

Host is Ubuntu 10.10 with multiple interfaces and multiple IPs per interface, including multiple IPv6 (has been this way for a couple years so it is not a fundamental way to break QEMU). QEMU is 0.12.5+noroms-0ubuntu7.8 as packaged by Ubuntu. Guest varies, including Xubuntu 12.04 amd64 and Slackware64 13.37.

UPDATE ... it works SOMETIMES. I was doing another test and booted an Xubuntu image I installed last week and up popped a notice that I had updates. I believe this checks the repository, so I check the network and this time it is working. I made a few more attempts, and it has worked 3 times now ... and failed about 12 times, mostly as a big run of failures. This is making even less sense. Latent bug that is sometimes trigger by something environmental? Now it does look like time to check for updates of QEMU.
 
Old 06-10-2012, 08:15 AM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
Quote:
I am using the "-net nic -net user" options on the QEMU command line
Have you specified the model of NIC to be emulated? e.g.
Code:
-net nic,model=rtl8139
 
Old 06-10-2012, 12:26 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
The user option has changed back and forth over the years. It should work fine for this. If it did work at all once then we can assume that the nic is being used correctly.

Leave it out and it should still work I think.

I'd be more tempted to suspect your ISP has some issues or your dns entry in the VM need to be added or updated. Try adding your local router's IP address to it.


Stop using ping. You don't care if you can ping the dhcp virtual server.

More help.
http://www.linux-kvm.org/page/Networking

This looks like the old Ballard docs.

http://qemu.weilnetz.de/qemu-doc.html

Last edited by jefro; 06-10-2012 at 12:29 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VDE networking in QEMU trademark91 Slackware 2 02-28-2011 08:29 PM
QEMU and networking? Zmyrgel Linux - General 4 10-09-2006 02:12 AM
Xen Vs Qemu Networking depam Linux - Software 0 03-04-2006 03:56 AM
Qemu networking Again?! depam Linux - Software 6 02-28-2006 09:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 07:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration