You can do it without install Guest Addition
But you need to know your networks
for example, we have VM with two adapters
one for Internet communication
second for host only communication
you can see network with command VBoxManage list
nat network:
% VBoxManage list natnets
NetworkName: NatNetwork
IP: 10.10.12.1
Network: 10.10.12.0/24
DHCP Enabled: Yes
Enabled: Yes
host only network
% VBoxManage list hostonlyifs
Name: vboxnet0
DHCP: Disabled
IPAddress: 192.168.6.1
NetworkMask: 255.255.255.240
here is main part
show running VMs
% vboxmanage list runningvms
"centos7 node0 ip test" {46ec9075-f49b-4d16-9867-d56710b6a3da}
we need VM uuid
it is 46ec9075-f49b-4d16-9867-d56710b6a3da
now we can fetch MAC addresses
% vboxmanage showvminfo --details 46ec9075-f49b-4d16-9867-d56710b6a3da | fgrep MAC
NIC 1: MAC: 08002783E8BB, Attachment: NAT Network 'NatNetwork', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2: MAC: 080027D992F0, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
08002783E8BB for first adapter in 'NatNetwork' network
080027D992F0 for second adapter for 'vboxnet0' interface
now we can get IP from DHCP table
for first adapter
% vboxmanage dhcpserver findlease --network NatNetwork --mac-address=08002783E8BB
IP Address: 10.10.12.4
MAC Address: 08:00:27:83:e8:bb
State: acked
Issued: 2020-07-13T13:31:20Z (1594647080)
Expire: 2020-07-13T13:41:20Z (1594647680)
TTL: 600 sec, currently 586 sec left
and for second
% vboxmanage dhcpserver findlease --interface vboxnet0 --mac-address=080027D992F0
IP Address: 192.168.6.3
MAC Address: 08:00:27:d9:92:f0
State: acked
Issued: 2020-07-13T13:29:06Z (1594646946)
Expire: 2020-07-13T13:39:06Z (1594647546)
TTL: 600 sec, currently 399 sec left
please note
for nat network we use option --network
for host only adapter we use option --interface
now we connect to this VM from host by ssh
% ssh [email protected]
[email protected]'s password:
Last login: Mon Jul 13 09:05:33 2020
[root@node0 ~]#