to put it simple, here are two machines in my local intranet.
One is Ubuntu based Pop!-OS computer, the other is a Windows 10 DELL desktop. Both computers are wirelessly connected to a local home network.
Now on my Windows 10 destop I installed virtualbox 6.0.1, on which I installed ubuntu based Linux distro, Kali.
For my own reason i need to set a static IP for the Kali VM, basically I followed this article for the setup. To recap, here are the specs:
- from the host network manager of Virtual box, the ipv4 setting is:
192.168.56.1, DHCP disabled.- For the network setting for Kali, on adapter 1 tab, the network mode
is: NAT, on adapter2 tab, attached to host-only network configured in
step1.On the Kali VM, the file /etc/network/interfaces:
#The host-only network interface auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 network 192.168.56.1 broadcast 192.168.56.255
This setting was effective and verified through the command “ifconfig”
here is what I observed:
From the virtual box host (Windows 10), I can ping the guest OS (Kali):
ping 192.168.56.101
However I can’t do the same from my other computer (pop!-OS), when I ping Kali using the above same command, it returned:
(base) jon@pop-os:~$ ping 192.168.56.101 PING 192.168.56.101 (192.168.56.101) 56(84) bytes of data. From 67.59.236.253 icmp_seq=1 Packet filtered
Here are a few notes worthy mentioning:
- The gateway of the local network is: 192.168.86.1 ( I don’t know why
the default host network on virtualbox was set to 192.168.56.1, does
it make the virtual box and its VMs a subnet?)- I switch the network mode on Kali from NAT to bridged, it remained
the same: I can’t ping from a separate computer other than the host
DELL desktop (Window 10).- I don’t know where the ip 67.59.236.253 came from. It’s not the ip
that my ISP provider assigned to me.My goal is to be able to connect to Kali from any computer in my intranet therefore I can use its services such as database server.
Anyone please help me make things right?
Answer
When you select NAT, your computer creates a virtual LAN with its own gateway and assigns VMs IP addresses from this virtual LAN. It seems your virtual LAN is 192.168.56.0/24
with the gateway 192.168.56.1
and you have assigned to your VM the IP address 192.168.56.101/24
. The problem is, only the host that created the virtual LAN knows about its existence. Whenever you make a connection from your VM to the outside world, the host handles the requests and sends it with the host’s IP address. Nobody outside this host sees the VM’s IP addres, or can directly reach the VM.
To be able to reach this VM from another device you either have to create special incoming NAT rules, or change the VM network from NAT to bridge and assign to the VM an address from your physical LAN, which seems to be 192.168.86.0/24
.
Attribution
Source : Link , Question Author : J.E.Y , Answer Author : gmelis