I need to SSH from guest VM (Linux/Debian 9) to its host running VirtualBox on a Windows 10 machine. Network configuration: NAT.
Which Linux command can I use to figure out the IP of the host from within the guest?
$ ip route show default
default via 10.0.2.2 dev eth0 proto static
10.0.2.0/24 dev etho proto kernel scope link src 10.0.2.15
In the above, 10.0.2.2
is the address of the host which is routing packets from the guest's IP (10.0.2.15
above for reference)
If you prefer getting the IP itself, you could use grep
and cut
(or just awk
), eg:
$ ip route show default | grep default | cut -d ' ' -f3
10.0.2.2
sshd
flavour though.