mercredi 29 avril 2020

Virtualbox reset IP-address of vboxnet0 on linux

When trying to connect to a service in a virtualbox-guest-machine throu a java-backend I noticed that the IP-Address of the vboxnet0 interface becomes a reset (bug reported but closed 2012).

Guest-Machine in virtualbox is:

  • WinXP (IP: 10.0.2.15, Subnetmask: 255.255.255.0)

Host system running virtualbox is:

  • Ubuntu, vboxnet0 (IP: 192.168.56.1, Subnetmask: 255.255.255.0)

Theese are the commands I used to force to set the vboxnet0 interface to ip 10.0.2.2:

[root@rm-2  rm2.sxixus.de ~]# ifconfig vboxnet0 && date
vboxnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.1  netmask 255.255.255.0  broadcast 192.168.56.255               <-- WRONG at 12:04:26
        inet6 fe80::800:27ff:fe00:0  prefixlen 64  scopeid 0x20<link>
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 669  bytes 86020 (86.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Wed Apr 29 12:04:26 CEST 2020
[root@rm-2  rm2.sxixus.de ~]# ifconfig vboxnet0 10.0.2.2                              <-- set 10....
[root@rm-2  rm2.sxixus.de ~]# ifconfig vboxnet0 && date                               <-- OK at 12:05.01
vboxnet0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.0.2.2  netmask 255.0.0.0  broadcast 10.255.255.255
        inet6 fe80::800:27ff:fe00:0  prefixlen 64  scopeid 0x20<link>
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 669  bytes 86020 (86.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Wed Apr 29 12:05:01 CEST 2020
[root@rm-2  rm2.sxixus.de ~]# ifconfig vboxnet0 && date                                <-- WRONG at 12:05:03
vboxnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.1  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::800:27ff:fe00:0  prefixlen 64  scopeid 0x20<link>
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 671  bytes 86200 (86.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Wed Apr 29 12:05:03 CEST 2020
[root@rm-2  rm2.sxixus.de ~]#

This is my application log:

29-Apr-2020 12:03:51.954 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Trigger snapshot creation.
29-Apr-2020 12:03:51.954 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Try to start the VM in headless mode.
29-Apr-2020 12:03:52.499 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Successfully started VM.
29-Apr-2020 12:03:53.015 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Time left to create snapshot: 59500
        (... snip)
29-Apr-2020 12:04:30.075 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check if route from vboxnet0 to guest-machine is possible.
29-Apr-2020 12:04:30.076 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check if route from vboxnet0 to guest-machine (0) is possible.
29-Apr-2020 12:04:30.076 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check ipv4 connection between guest  10.0.2.15(255.255.255.0) and host 192.168.56.1(255.255.255.0)
29-Apr-2020 12:04:30.076 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check ipv4 dec notation connection between guest  452984832(-50331648) and host -1593835520(-50331648)
29-Apr-2020 12:04:30.076 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Can guest reach host? false
29-Apr-2020 12:04:30.076 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Can host reach guest? false
29-Apr-2020 12:04:30.092 WARNING [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations No bidirectional route between host-system and guest-system.
29-Apr-2020 12:04:30.093 WARNING [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Could not connect to puppeteer.
29-Apr-2020 12:04:30.100 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Shutdown vm using poweroff.
29-Apr-2020 12:04:40.767 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:04:51.113 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:05:01.483 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:05:01.487 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Trigger snapshot creation.
29-Apr-2020 12:05:01.487 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Try to start the VM in headless mode.
29-Apr-2020 12:05:01.973 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Successfully started VM.
29-Apr-2020 12:05:02.499 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Time left to create snapshot: 59500
        (... snip)
29-Apr-2020 12:05:39.684 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Time left to create snapshot: 26500
29-Apr-2020 12:05:39.937 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check if route from vboxnet0 to guest-machine is possible.
29-Apr-2020 12:05:39.937 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check if route from vboxnet0 to guest-machine (0) is possible.
29-Apr-2020 12:05:39.937 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check ipv4 connection between guest  10.0.2.15(255.255.255.0) and host 192.168.56.1(255.255.255.0)
29-Apr-2020 12:05:39.938 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Check ipv4 dec notation connection between guest  452984832(-50331648) and host -1593835520(-50331648)
29-Apr-2020 12:05:39.938 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Can guest reach host? false
29-Apr-2020 12:05:39.938 FINE [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.findRoute Can host reach guest? false
29-Apr-2020 12:05:39.948 WARNING [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations No bidirectional route between host-system and guest-system.
29-Apr-2020 12:05:39.949 WARNING [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Could not connect to puppeteer.
29-Apr-2020 12:05:39.955 INFO [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Shutdown vm using poweroff.
29-Apr-2020 12:05:50.590 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:06:00.936 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:06:11.346 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:06:21.705 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.
29-Apr-2020 12:06:32.102 FINER [RM - Virtualbox Snapshot creation request] de.e_sxixus.test.vb.sync.VirtualboxPersistenceService.executeSnapshotCreations Create snapshot for machine using id #102.

Since I have about 20 different guest-machines and 400 different snapshots on the server the IP-Address of the vboxnet0 interface should not change.

Question

How to modify the ip-address of inet-interface vboxnet0?

How to avoid the change of the virtualbox IP address?

Aucun commentaire:

Enregistrer un commentaire