about DHCP server in qemu
Hello
I have some problems using the built-in DHCP server in qemu.
1. Is it possible to have guets connected?
If I launch 3 qemu, that I can do:
ping 10.2.0.15
ping 10.2.0.14
and so on.
In order to simulate a network?
2. I have some problems with some distro to get an adress:
for example, a slackware get an IP
a tomsrtbt doesn't get an IP
it seems that netBSD doesn't get an IP too (but I have to check another time for that).
Thank you
---------------------------------------------
Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
Quoted 11 lines · octane indice
Hello
I have some problems using the built-in DHCP server in qemu.
1. Is it possible to have guets connected?
If I launch 3 qemu, that I can do:
ping 10.2.0.15
ping 10.2.0.14
and so on.
In order to simulate a network?
No. In fact, the server is set up to always return the same IP in response to a request. Even if it worked like a full fledged DHCP server, there's no way to connect multiple guests together. The best you can do is slirpvde.
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Quoted 12 lines · Jim C. Brown
Quoted 10 lines · octane indice
Hello
I have some problems using the built-in DHCP server in qemu.
1. Is it possible to have guets connected?
If I launch 3 qemu, that I can do:
ping 10.2.0.15
ping 10.2.0.14
and so on. In order to simulate a network?
Quoted 4 lines
No. In fact, the server is set up to always return the same IP in response to a request. Even if it worked like a full fledged DHCP server, there's no way to connect multiple guests together. The best you can do is slirpvde.
err.. it works for me...
This gives me 9 qemu sessions that all get different 10.x.x.x ip addresses via dhcp
#!/bin/sh
rm /tmp/qemu-irc-*
for i in 1 2 3 4 5 6 7 8 9 ; do
qemu-img create -b /tracks/lin.img -f qcow /tmp/qemu-irc-$i
qemu -fda /tracks/floppy.img -hda /tmp/qemu-irc-$i -boot a -user-net -macaddr C0:0F:FE:01:01:9$i -m32 & done
Regards,
Brad
Signature · 3 lines
"Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so." -- Douglas Adams
Quoted 4 lines · Brad Campbell
Quoted 3 lines
No. In fact, the server is set up to always return the same IP in response to
a request.err.. it works for me...
Yes, it seems that Fabrice has slipped in a few changes since I last looked at the slirp code. :) The internal DHCP server can now support 16 dhcp clients. That's for multiple clients within a single qemu guest though (think multiple NICs here). I don't see any way for qemu guests to be able to ping each other (for example) if they are both using user-net.
Quoted 15 lines
Even if it worked like a full fledged DHCP server, there's no
Quoted 3 lines
way to
connect multiple guests together. The best you can do is slirpvde.This gives me 9 qemu sessions that all get different 10.x.x.x ip addresses via dhcp
#!/bin/sh
rm/tmp/qemu-irc-*
for i in 1 2 3 4 5 6 7 8 9 ; do
qemu-img create -b /tracks/lin.img -f qcow/tmp/qemu-irc-$iqemu -fda /tracks/floppy.img -hda/tmp/qemu-irc-$i-boot a -user-net -macaddr C0:0F:FE:01:01:9$i -m32 &
done
Quoted 2 lines
Regards,
Brad
I find it suprising that this works. From the code in slirp/bootp.c it looks like qemu's dhcp server will give out 10.0.2.15 first, then 10.0.2.16, and so on (so it goes in sequential order). But thats within a single qemu session. Theres no way for multiple user-net qemu guests to communicate (at least on the ethernet level) so the guests should have the same ip address. Very strange.
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
En réponse à "Jim C. Brown" <[email protected]> :
Quoted 9 lines
------------------ Début du message d'origine --------------------
Quoted 3 lines · Brad Campbell
Quoted 2 lines
No. In fact, the server is set up to always return the same IP in response to a request.
err.. it works for me...
Yes, it seems that Fabrice has slipped in a few changes since I last looked at the slirp code. :)
I use the last windows version of qemu. it's 0.7.2
Quoted 8 lines
The internal DHCP server can now support 16
dhcp clients.
That's for multiple clients within a single qemu guest though (think multiple
NICs here). I don't see any way for qemu guests to be able to ping each other
(for example) if they are both using user-net.
it would be good to get that working :)
Quoted 10 lines
Review
Quoted 10 lines
Even if it worked like a full fledged DHCP server, there's no
Quoted 3 lines
way to connect multiple guests together. The best you can do is slirpvde.
This gives me 9 qemu sessions that all get different 10.x.x.x ip addresses
via dhcp
qemu -fda /tracks/floppy.img -hda/tmp/qemu-irc-$i-boot a(quoted diff) +0
-2-user-net -macaddr C0:0F:FE:01:01:9$i -m32 &
Still doesn't work for me :/ I think that the problems comes from the tomsrtbt.
if tomsrtbt is the only guest : no IP given
if tomsrtbt is launch with -macaddr xx : no IP given if tomsrtbt is launch after another guest : no IP given
if I launch a real tomsrtbt, on a real host with a real DHCP server on the network, tomsrtbt got an IP
Signature · 2 lines
--------------------------------------------- Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
octane indice wrote:
[...]
Quoted 5 lines
Still doesn't work for me :/ I think that the problems comes from the tomsrtbt.
Quoted 7 lines
if tomsrtbt is the only guest : no IP given
if tomsrtbt is launch with -macaddr xx : no IP given if tomsrtbt is launch after another guest : no IP givenif I launch a real tomsrtbt, on a real host with a real DHCP server on the network, tomsrtbt got an IP
What dhcp client does tomsrtbt use?
If it uses dhclient (the ISC dhcp client), you should see some lines about DHCP in the syslog. With other clients (eg. pump) you can try to start the client manually (perhaps with some -v option to turn on verbose output) and see if it tells you something interesting.
Usually the clients indicate whether they found a dhcp server at all, and whether it supplied an ip address.
Good luck,
Oliver Gerlich
Quoted 6 lines · octane indice
Quoted 4 lines
I don't see any way for qemu guests to be able to
ping each other
(for example) if they are both using user-net.it would be good to get that working :)
Alas, that is so difficult it is nearly impossible.
Quoted 7 lines
if tomsrtbt is the only guest : no IP given
if tomsrtbt is launch with -macaddr xx : no IP given if tomsrtbt is launch after another guest : no IP givenif I launch a real tomsrtbt, on a real host with a real DHCP server on the network, tomsrtbt got an IP
Strange. Sounds like a bug in either tomsrtbt or qemu. Do you have a floppy image that can be downloaded?
Quoted 12 lines
Signature · 8 lines
--------------------------------------------- Etes vous un consom'Acteur ? Toutes les saveurs ?quitables sont sur http://www.epicerie-equitable.com _______________________________________________ Qemu-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
En réponse à "Jim C. Brown" <[email protected]> :
Quoted 11 lines
Quoted 6 lines
if tomsrtbt is the only guest : no IP given
if tomsrtbt is launch with -macaddr xx : no IP given if tomsrtbt is launch after another guest : no IP givenif I launch a real tomsrtbt, on a real host with a real DHCP server on the network, tomsrtbt got an IP
Strange. Sounds like a bug in either tomsrtbt or qemu. Do you have a floppy
image that can be downloaded?
http://www.toms.net/rb or
http://public.planetmirror.com/pub/tomsrtbt/
http://downloads.planetmirror.com/pub/tomsrtbt/tomsrtbt-2.0.103.tar.gz
unzip it, and the file tomrtbt.raw is
directly bootable. The file is 1.7Mb big, but it's a floppy. qemu -m 8 -fda tomsrtbt.raw -boot a
is enough.
The dhcpcd client is a self written client in lua.
I found that info:
http://not.toms.net/twiki/bin/view/Tomsrtbt/DHCPRequestsTooSmall
that says that the DHCP requests from tomsrtbt is very small (under 300 bytes) and the solaris DHCP server doesn't give IP. But linux DHCP server (and windows DHCP server) works fine.
---------------------------------------------
Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
Quoted 10 lines · Jim C. Brown
Quoted 6 lines · octane indice
Quoted 4 lines
I don't see any way for qemu guests to be able to
ping each other
(for example) if they are both using user-net.it would be good to get that working :)
Alas, that is so difficult it is nearly impossible.
Nearly? Oh come on... you know it ain't possible, period.
Ping (ICMP) operates at the IP level. An unprivileged socket, which is what user-net (slirp) uses can only send/receive packets at the ported protocols level, which means UDP or TCP.
Of course, why ping? If all you need to do is validate connectivity, find some ported protocol service to connect to in order to validate connectivity.
If non-ported protocols like ICMP must be supported use tun/tap.
-- John.
Quoted 1 line · John R. Hogerhuis
Nearly? Oh come on... you know it ain't possible, period.
It's possible. It just entails adding something like vde to user-net allowing multiple qemus to talk to each other (not using the slirp code).
but it's simpler and more robust to just use vde. There even exists a slirp plug for vde to allow user-net like connectivity out from the virtual lan provided by vde, and DHCP servers to make life simple.
Regards
Henrik
Quoted 2 lines · John R. Hogerhuis
Nearly? Oh come on... you know it ain't possible, period.
What are you refering to? The ability of a single qemu to ping thru slirp, or the ability of multiple qemus to ping each other using their guest ips?
The former can be done, as explained below, but it is probably more trouble than its worth. The latter can not be done at all *IF* the guests have to communicate thru the slirp layer. However, if the slirp layer is just used to talk to the host and the LAN/internet and you have something else that deals with guest-to-guest, then this can be done. slirpvde comes to mind here.
Quoted 4 lines
Ping (ICMP) operates at the IP level. An unprivileged socket, which is what user-net (slirp) uses can only send/receive packets at the ported protocols level, which means UDP or TCP.
Actually, it is really easy to add ping support to qemu using sockets. The only issue here is privilege. (You need to be root in order to be able to use an ICMP socket.)
An alternative would be to use "/sbin/ping -c 1" and parse its output in order to simulate an actual ICMP connection. This is considerably harder, but definitely possible.
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Well I tried it myself and it doesn't work. eth0 gets an IP of 1.1.1.1 but nothing is pingable.
I tried to make the packet sizes larger than 300 bytes just in case that was the cause of the error (tho thats unlikely imvho), but that just got me a syntax error from lua.
Quoted 38 lines · octane indice
En r?ponse ? "Jim C. Brown" <[email protected]> :
Quoted 11 lines
Quoted 6 lines
if tomsrtbt is the only guest : no IP given
if tomsrtbt is launch with -macaddr xx : no IP given if tomsrtbt is launch after another guest : no IP givenif I launch a real tomsrtbt, on a real host with a real DHCP server on the network, tomsrtbt got an IP
Strange. Sounds like a bug in either tomsrtbt or qemu. Do you have a floppy
image that can be downloaded?http://www.toms.net/rb or
http://public.planetmirror.com/pub/tomsrtbt/
http://downloads.planetmirror.com/pub/tomsrtbt/tomsrtbt-2.0.103.tar.gzunzip it, and the file tomrtbt.raw is
directly bootable. The file is 1.7Mb big, but it's a floppy. qemu -m 8 -fda tomsrtbt.raw -boot a
is enough.The dhcpcd client is a self written client in lua.
I found that info:
http://not.toms.net/twiki/bin/view/Tomsrtbt/DHCPRequestsTooSmall
that says that the DHCP requests from tomsrtbt is very small (under 300 bytes) and the solaris DHCP server doesn't give IP. But linux DHCP server (and windows DHCP server) works fine.---------------------------------------------
Etes vous un consom'Acteur ? Toutes les saveurs ?quitables sont sur http://www.epicerie-equitable.com_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Quoted 2 lines · Jim C. Brown
Well I tried it myself and it doesn't work. eth0 gets an IP of 1.1.1.1 but nothing is pingable.
1.1.1.1 is not a QEMU given IP.
Try manually assigning the IP 10.0.2.15/24(255.255.255.0) to the quest with a default route to 10.0.2.2. This should work.
It is quite possible the guest is not happy about something in the qemu DHCP reply. QEMU responds with a DHCP reply even if the client sent a BOOTP request and this can confuse some badly implemented BOOTP clients, and the number of DHCP options returned differ slightly from most DHCP servers possibly confusing some DHCP clients expecting additional options.
Regards
Henrik
Quoted 2 lines · Henrik Nordstrom
1.1.1.1 is not a QEMU given IP.
I know. I have no idea why that shows up.
Quoted 3 lines
Try manually assigning the IP 10.0.2.15/24(255.255.255.0) to the quest with a default route to 10.0.2.2. This should work.
Already did. It does. 10.0.2.2 is pingable, at least.
Quoted 6 lines
It is quite possible the guest is not happy about something in the qemu DHCP reply. QEMU responds with a DHCP reply even if the client sent a BOOTP request and this can confuse some badly implemented BOOTP clients, and the number of DHCP options returned differ slightly from most DHCP servers possibly confusing some DHCP clients expecting additional options.
The client is definitely using (and expecting) DHCP, not BOOTP. Oddly enough, it gets a timeout error. Very strange.
I tried to test out pump under tomsbrt but it refused to work; I'm too lazy to attempt recompile a real dhcp client under a floppy linux. Since the pump binary that I was using works under the redhat distro that it came from, I'm guessing that its a bug in the LUA client. Will investigate further.
Quoted 9 lines
Regards
Henrik_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
"Jim C. Brown" <[email protected]> :
Quoted 4 lines
Quoted 1 line
1.1.1.1 is not a QEMU given IP.
I know. I have no idea why that shows up.
tomsrtbt workaround if there is no DHCP server
Signature · 2 lines
--------------------------------------------- Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
En réponse à "Jim C. Brown" <[email protected]> :
Quoted 30 lines
Quoted 1 line
Nearly? Oh come on... you know it ain't possible, period.
What are you refering to? The ability of a single qemu to ping thru slirp,
or the ability of multiple qemus to ping each other using their guest ips?The former can be done, as explained below, but it is probably more trouble
than its worth. The latter can not be done at all *IF* the guests have to
communicate thru the slirp layer. However, if the slirp layer is just used to
talk to the host and the LAN/internet and you have something else that deals
with guest-to-guest, then this can be done. slirpvde comes to mind here.Quoted 5 lines
Ping (ICMP) operates at the IP level. An unprivileged socket, which is
what user-net (slirp) uses can only send/receive packets at the ported
protocols level, which means UDP or TCP.Actually, it is really easy to add ping support to qemu using sockets. The only
issue here is privilege. (You need to be root in order to be able to use an
ICMP socket.)
Quoted 5 lines
An alternative would be to use "
/sbin/ping-c 1" and parse its output in order
to simulate an actual ICMP connection. This is considerably harder, but definitely possible.
And what about a full IP connection beetween hosts? In order to simulate a real network to do nfs/smtp/http/smb and so on?
I was thinking of a sort of a net-server which handles the DHCP process, the connection for going outside (masquerade+DNS+SMB) and the connection beetween hosts.
Signature · 2 lines
--------------------------------------------- Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
Quoted 2 lines · octane indice
And what about a full IP connection beetween hosts? In order to simulate a real network to do nfs/smtp/http/smb and so on?
This is done with a TUN/TAP device, or via a VDE switch using TUN/TAP to connect to the host.
Regards
Henrik
I think you meant "guests" instead of "hosts".
I second that. I would still like to use qemu to
perform network simulations myself...
Quoted 7 lines · octane indice
And what about a full IP connection beetween hosts? In order to simulate a real network to do nfs/smtp/http/smb and so on?
I was thinking of a sort of a net-server which handles the DHCP process, the connection for going outside (masquerade+DNS+SMB) and the connection beetween hosts.
--
Quoted 3 lines · Christian MICHON
I think you meant "guests" instead of "hosts".
I second that. I would still like to use qemu to
perform network simulations myself...
This is done very nicely by VDE.
Regards
Henrik
Quoted 6 lines · octane indice
And what about a full IP connection beetween hosts? In order to simulate a real network to do nfs/smtp/http/smb and so on?
I was thinking of a sort of a net-server which handles the DHCP process, the connection for going outside (masquerade+DNS+SMB) and the connection beetween hosts.
huh? hosts?
if u really mean guests, then i'd recommend using vde (or wait for Fabrice's new group usernet mode). if u really mean host, i'd recommend using tuntap.
Quoted 11 lines
Signature · 8 lines
--------------------------------------------- Etes vous un consom'Acteur ? Toutes les saveurs ?quitables sont sur http://www.epicerie-equitable.com _______________________________________________ Qemu-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
En réponse à "Jim C. Brown" <[email protected]> :
Quoted 11 lines · octane indice
Quoted 7 lines
And what about a full IP connection beetween hosts? In order to simulate a real network to do nfs/smtp/http/smb and so on?
I was thinking of a sort of a net-server which handles the DHCP process, the connection for going outside (masquerade+DNS+SMB)
and the connection beetween hosts.huh? hosts?
er, no. It shoulded be guests.
Quoted 2 lines
if u really mean guests, then i'd recommend using vde (or wait for Fabrice's new group usernet mode).
Ok, I'm waiting for that.
---------------------------------------------
Etes vous un consom'Acteur ? Toutes les saveurs équitables sont sur http://www.epicerie-equitable.com
do you happen to have vde for win32 ?
If yes, please point it to me, because I've googled for one with no luck... :)
Quoted 11 lines · Henrik Nordstrom
Quoted 3 lines · Christian MICHON
I think you meant "guests" instead of "hosts".
I second that. I would still like to use qemu to
perform network simulations myself...This is done very nicely by VDE.
Regards
Henrik
--
Christian
Quoted 4 lines · Christian MICHON
do you happen to have vde for win32 ?
If yes, please point it to me, because I've googled for one with no luck... :)
Porting VDE to windows is fairly easy.
The hard part is getting qemu to work with it. Unlike POSIX OSes, Windows doesn't provide unix sockets (so no c:\tmp\vde.ctl). I am not sure if the -tun-fd option even works on Windows hosts.
So to make it work, we'd either have to add new code to qemu to connect to VDE on windows or port qemu to cygwin (for real).
Quoted 23 lines · Henrik Nordstrom
Quoted 11 lines · Christian MICHON
Quoted 4 lines
I think you meant "guests" instead of "hosts".
I second that. I would still like to use qemu to
perform network simulations myself...This is done very nicely by VDE.
Regards
Henrik--
Christian_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Quoted 3 lines · Christian MICHON
do you happen to have vde for win32 ?
If yes, please point it to me, because I've googled for one with no luck... :)
Should build fine using cygwin I think.
Regards
Henrik