Skip to contentSkip to conversation

IP mismatch in redirection using user-net dhcp

Qemu-devel Yann Dirson 2 participants 2 messages Jan 16, 2006

lore
Share & tools
lore
#0 lore raw

For some as-yet-unknown reason, the IP assigned by the user-net DHCP server occasionally switches to 10.0.2.16. I suspect this happens while renewing the lease while I'm away, since that would explain why the headless VM is unreachable when I come back on mondays - then when booting with SDL display, I find out the IP is 10.0.2.16.

This would not be a problem at all, if the port redirections would know about that, but a tcpdump in the VM shows that my "-redir tcp:10080::10080" is indeed taken as "tcp:10080:10.0.2.15:10080", even though the attributed IP is 10.0.2.16. Not sure how qemu could be taught to do something sensible here, without breaking multi-NIC setups.

But with some luck we should not have to bother with it, if only the problem is just that the lease renewal is broken.

Bringing the (gentoo/dhcpcd) VM back on its feet seems to require all of the following steps, which is quite error-prone (and time-consuming when a single step is missed;):
- "dhcpcd -k", which clears /var/cache/dhcpcd-eth0.cache
- removing /var/lib/dhcpc/*
- restarting qemu itself so that it forgets about the lease as well

Would it make sense to be able to tell qemu "do not ever issue a lease on an IP different from 10.0.2.15", and possibly make that the default for single-NIC VMs ?

Signature · 2 lines
Yann Dirson <[email protected]>
             <[email protected]>
#1 lore raw
Quoted 3 lines

Would it make sense to be able to tell qemu "do not ever issue a lease on an IP different from 10.0.2.15", and possibly make that the default for single-NIC VMs ?

You could tie the IP to the MAC address. Ie. make the dhcp code discard the previous lease if it gets another request from the same MAC address. This should work for all setups.

Paul