I have a problem understanding how Qemu and the network work in a guest OS (Ubuntu). I read this guide and others. And if I understand, if you want to pick up the Internet in the guest OS, you need to do a touch on the interface in the host OS. After that, to bind the eth0 and tap0 interfaces :
- Using NAT Routing
- Using the bridge (link tap0 and eth0-host )
Now I have these interfaces in the host ( ppp0 - 3G modem - Internet, lo):
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.245.146.78 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:49635 errors:0 dropped:0 overruns:0 frame:0
TX packets:42745 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:52405401 (52.4 MB) TX bytes:5988643 (5.9 MB)
On gust OS ( eth0 , lo):
eth0 Link encap:Ethernet HWaddr:52:54:00:12:34:56
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
...
! , ppp0 ? .
, . ?
Qemu:
qemu -hda ~/virt.disk -cdrom /dev/cdrom -boot once=dc -m 1024M -usb -smp 2 -enable-kvm
:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.64.64.64 * 255.255.255.255 UH 0 0 0 ppp0
default 10.64.64.64 0.0.0.0 UG 0 0 0 ppp0
:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.2.0 * 255.255.255.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 10.0.2.2 0.0.0.0 UG 0 0 0 eth0