I’m a bit confused: do you
a) Keep the same IP address because the connection never gets disconnected? In 
that case an IFDOWN/IFUP should do the trick. (Or physically 
disconnecting/connecting).
b) The connection gets physically disconnected, but gets its original IP 
address back from DHCP.
                In this case your chosen subnet mask (/24) doesn’t match the 
DHCP’s server’s subnet setting. You have to make them match: DHCP can’t detect 
what your subnet mask is!
                And since you’re using a 10.x.x.x address, it’s likely that you 
DHCP server uses a 255.0.0.0 mask (since that’s its default for a class A 
address).

Cheers,

~ Paul

From: Malcolm Clarke [mailto:[email protected]]
Sent: Thursday, October 19, 2017 10:04 AM
To: Community mailing list of VirtualBox users 
<[email protected]<mailto:[email protected]>>;
 Kees Nuyt <[email protected]<mailto:[email protected]>>
Subject: Re: [VBox-users] VBox does not forget DHCP lease when VM moved to 
different subnet


The guest will not release the lease as it does not know it is being moved. I 
assume that any DHCP will realise that the IP address should match the subnet 
on which they are connected, automatically.

I think there is a single DHCP process as part of VBox, but I do not know.

Disconnect/connect (ie disable/enable) of the adapter may work so I will test.

Regards

Malcolm

On 19/10/2017 14:41, Kees Nuyt wrote:

On Thu, 19 Oct 2017 11:33:42 +0100, you wrote:



We have met a problem when we move VM from one subnet to a different

subnet, and the DHCP remembers the previous lease and continues to

provide the same IP address to the VM, even though it is now on a

different subnet.



We have a simple set up where we define two NatNetworks with separate IP

address (10.0.2.0/24 and 10.0.3.0/24) we study behaviour of a router

between these networks. We place an Ubuntu guest on each subnet.

If we place a guest on the first network it is allocated IP address (eg)

10.0.2.4. If we then move it to the second network it continues to

receive an IP address from DHCP of 10.0.2.4, and so cannot function on

the second network.



Does the guest release the lease before it is moved?



I agree networks should have independent DHCP leases.

Did you define a separate dhcpserver for each netowrk?



The workaround is to delete the lease file when VB is not running. We

would prefer the DHCP to properly recognise the subnet of a device and

allocate IP address accordingly.



Another workaround might be to change the MAC address of the

guest when it moves to the other subnet. You could even spoof

the MAC from within the guest, if the OS allows that.



Or perhaps define as many network interfaces in the guest as you

have networks, and disconnect/connect to move it to another

network. Not easy thoughm, and pretty ugly.



--
Malcolm Clarke BSc (Hons), PhD
Reader in Telemedicine and Data Communication Systems
T +44 (0) 1895 265053

Brunel University London
College of Engineering, Design and Physical Sciences
Department of Computer Science

WBB212, Wilfred Brown Building, Kingston Lane, Uxbridge, Middlesex, UB8 3PH

www.brunel.ac.uk<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.brunel.ac.uk_&d=DwMDaQ&c=lPSrKxmr9G9WwiUkGOr8-w&r=sC6YSgpIA6rsgLOfCvFTtAdRZXoL9vw1ByH2NKOjiUY&m=AY9Q0oUnU0abEoTi6FxeOQxS0-jz_r8CR5EdtuQ_b6s&s=lLvB7pNS1-x78lDbRcg2tBknzg9J5GJVEApJmot-Bm0&e=>

Connect with the university on Linkedin, Twitter, Facebook

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VBox-users-community mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vbox-users-community
_______________________________________________
Unsubscribe:  
mailto:[email protected]?subject=unsubscribe

Reply via email to