virtualisation with kvm: export services from guest to the host
Posted
by ascobol
on Server Fault
See other posts from Server Fault
or by ascobol
Published on 2010-04-30T15:28:07Z
Indexed on
2010/04/30
15:39 UTC
Read the original article
Hit count: 392
Hello,
I would like to export some services from the guest os to the host os, via kvm, and by the same way learn some things about networking. I have tried the following commands:
In the host (kubuntu 10.4):
$ sudo tunctl -u ascobol
Set 'tap0' persistent and owned by uid 2401
$ sudo ifconfig tap0 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
The ifconfig command returns:
$ /sbin/ifconfig
tap0 Link encap:Ethernet HWaddr 3e:4e:e3:cc:bc:92
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::3c4e:e3ff:fecc:bc92/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:17 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tap0
Then I run the virtual machine (ubuntu server 10.4):
$ sudo kvm -hda ubuntuserver104.qcow2 -net nic -net tap,name=tap0,script=no
(I'm using sudo because without it fails with the following message:)
warning: could not configure /dev/net/tun: no virtual network emulation
With sudo the virtual machine boots, I just get this message:
pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
In the virtual machine:
$ ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
Now if I run:
$ ssh 192.168.2.2
I just get a
No route to host
What is wrong with this setup ? Thanks !
© Server Fault or respective owner