Refresh Ubuntu Guest IP [Without Reboot?]

Discussions about using Linux guests in VirtualBox.
Post Reply
apollostees
Posts: 3
Joined: 27. Oct 2015, 14:27

Refresh Ubuntu Guest IP [Without Reboot?]

Post by apollostees »

Hello all,
(first post so please go easy.)

I work in a lab and so I often have to switch between different networks, access points, VPNs etc. Both wired and wireless. My problem is that after changing networks the VM can never pull a new IP from the DHCP server without a complete reboot. This method is slow, and it requires me to re-setup any test I may be running.

The guest is Ubuntu 14.04 64bit, however after doing some research I'm convinced that this isn't an Ubuntu issue. (I know all about the 'dhclient' command). I believe this is a VirtualBox limitation.

Is there any virtualbox command (faster and more efficient than a reboot) that will allow the guest to request a new IP from the current DHCP client? (Perhaps in conjunction with dhclient)

My setup: VB Version 5.0.6 r103037, HOST=Windows 7 64bit, GUEST=Ubuntu 14.04, Network Bridged Adapter
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Refresh Ubuntu Guest IP [Without Reboot?]

Post by Perryg »

Using bridged mode the guest is actually working as a stand alone device on the LAN. Meaning the guest has to request its addressing from the LAN and this is not a VirtualBox provided connection as such. That said I have seen this kind of issue reported before when using WIFI instead of Eth LAN and the usual thing to do is to run dhclient ( elevated ) on the guest. Some have had to use the cable connect feature in VBox or simple shut down the guests network and restart it. ( ifconfig eth* down | ifconfig eth* up ).

Moving to Linux guest as it more closely fits the issue.
apollostees
Posts: 3
Joined: 27. Oct 2015, 14:27

Re: Refresh Ubuntu Guest IP [Without Reboot?]

Post by apollostees »

Thanks for the speedy reply. I wish I could say that resolved the issue, but unfortunately it did not.

Code: Select all

root@UBUNTU-64:/true_desktop# ifconfig eth0 down
root@UBUNTU-64:/true_desktop# ifconfig eth0 up
root@UBUNTU-64:/true_desktop# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:25:0d:07  
          inet6 addr: fe80::a00:27ff:fe25:d07/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1837 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:371353 (371.3 KB)
Oddly enough, running the dhclient command took an exceedingly long time (several minutes) and it still came up empty.

Code: Select all

root@UBUNTU-64:/true_desktop# dhclient
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data.

--- 10.0.2.2 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
Meanwhile the host is on the internet creating this post???
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Refresh Ubuntu Guest IP [Without Reboot?]

Post by Perryg »

Where is the 10.0.2.* address coming from? That is the same address scheme that VBox NAT uses and you stated you are using Bridged.

From the hosts terminal/command window type VBoxManage showvminfo <VM Name> --details and post here. Replace <VM Name> with the actual name of the VM. Use " " if the name has a space in it.

Note if the host is Windows you need to be in the directory that has VBoxManage.exe for the command to work.

Also post the guests log file ( as an attachment )
apollostees
Posts: 3
Joined: 27. Oct 2015, 14:27

Re: Refresh Ubuntu Guest IP [Without Reboot?]

Post by apollostees »

VBoxManage showvminfo UBUNTU_64 --details

Code: Select all

C:\Program Files\Oracle\VirtualBox> VBoxManage showvminfo UBUNTU_64 --details
Name:            UBUNTU_64
Groups:          /
Guest OS:        Ubuntu (64-bit)
UUID:            29ab187c-2e13-462b-b7eb-056008ae92b8
Config file:     C:\Users\apollostees\VirtualBox VMs\UBUNTU_64\UBUNTU_64.vbox
Snapshot folder: C:\Users\apollostees\VirtualBox VMs\UBUNTU_64\Snapshots
Log folder:      C:\Users\apollostees\VirtualBox VMs\UBUNTU_64\Logs
Hardware UUID:   29ab187c-2e13-462b-b7eb-056008ae92b8
Memory size:     2048MB
Page Fusion:     off
VRAM size:       12MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
PAE:             off
Long Mode:       on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
State:           running (since 2015-10-27T13:27:46.821000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): C:\Users\apollostees\VirtualBox VMs\UBUNTU_64\UBUNTU_64.vdi (UUID: 02
e7f05-192a-4f17-889d-9697b6d8d6f1)
NIC 1:           MAC: 080027250D07, Attachment: Bridged Interface 'Intel(R) Eth
rnet Connection I218-LM', Cable connected: on, Trace: off (file: none), Type: 8
540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidt
 group: none
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: DSOUND, Controller: AC97, Codec: AD1980)
Clipboard Mode:  Bidirectional
Drag and drop Mode: disabled
Session name:    GUI/Qt
Video mode:      1600x796x32 at 0,0 enabled
VRDE:            disabled
USB:             enabled
EHCI:            disabled
XHCI:            disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:

Name: 'Desktop', Host path: 'C:\Users\apollostees\Desktop' (machine mapping), writ
ble

VRDE Connection:    not active
Clients so far:     0

Video capturing:    not active
Capture screens:    0
Capture file:       C:\Users\apollostees\VirtualBox VMs\UBUNTU_64\UBUNTU_64.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25

Guest:

Configured memory balloon size:      0 MB
OS type:                             Linux26_64
Additions run level:                 2
Additions version:                   5.0.6 r103037


Guest Facilities:

Facility "VirtualBox Base Driver": active/running (last update: 2015/10/27 13:2
:01 UTC)
Facility "VirtualBox System Service": active/running (last update: 2015/10/27 1
:49:26 UTC)
Facility "Seamless Mode": active/running (last update: 2015/10/27 13:28:01 UTC)
Facility "Graphics Mode": active/running (last update: 2015/10/27 13:28:01 UTC)



C:\Program Files\Oracle\VirtualBox>
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Refresh Ubuntu Guest IP [Without Reboot?]

Post by Perryg »

Can you answer the first question as to the 10.0.2.* and provide the log file ( as an attachment )
Post Reply