VirtualBox: Find Host IP Address from the Guest Machine (Linux) in NAT Connection


I wrote the way to check host machine IP address from VirtualBox guest machine connected as NAT. Substantially speaking, it is the gateway address of the guest machine.

History

When I launched Kotlin API server in Host, Windows, and Launched Rails Web application in Guest Linux, I needed to know the host machine IP address for accessing to the API.

Environment

  • Host: Windows 10
  • Guest: Ubuntu 17.10
  • VirtualBox version 5.1.30

Method

Use command, netstat -rn, in the guest.

The IP address appears in gateway section is the host OS IP address. In above case, 10.0.2.2.