This happens about every 30 - 90 minutes I guess, not exactly sure.
I have a Linux Mint VM with a secondary Host-Only adapter (the first one is the standard NAT).
ifconfig
of the interface when working:
enp0s8 Link encap:Ethernet HWaddr 08:00:27:9b:62:20
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::2838:d4ae:d350:b822/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6479 errors:0 dropped:0 overruns:0 frame:0
TX packets:5952 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1586768 (1.5 MB) TX bytes:10166856 (10.1 MB)
and when not working:
enp0s8 Link encap:Ethernet HWaddr 08:00:27:9b:62:20
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6441 errors:0 dropped:0 overruns:0 frame:0
TX packets:5917 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1574095 (1.5 MB) TX bytes:10162092 (10.1 MB)
If I bring the interface down and then up again it will work again, but it's a nuisance and I have to restart the web server as well.
How do I stop it from losing the IP?
Which log files would hold any useful info on this issue?
EDIT: Could it be a power management issue?
EDIT 2: Sometimes it only loses the IPv4:
enp0s8 Link encap:Ethernet HWaddr 08:00:27:9b:62:20
inet6 addr: fe80::2838:d4ae:d350:b822/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15434 errors:0 dropped:0 overruns:0 frame:0
TX packets:38413 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3296715 (3.2 MB) TX bytes:65539683 (65.5 MB)
答案1
Using @Blaine's suggestion, I set up a static ip for the VM, using this link:
http://coding4streetcred.com/blog/post/VirtualBox-Configuring-Static-IPs-for-VMs
The only issue after that was that I had to check "use this connection only for resources on its network" under "Routes" for the host-only, so that the internet traffic would be routed through the NAT and not the host-only.