My VirtualBox version: So finally you have a Ubuntu-master machine running and an Ubuntu-slave machine running and both of them in VirtualBox. But they are not talking to each other. By default if you do not set-up a separate NAT network, they will both be NAT'ed. But they will be NAT'ed in isolated environment. For instance, I have got Ubuntu-master in one window. If I do an "ifconfig" and this is in VirtualBox. I see my IP address as 10.0.2.15. In the other Window, I have Ubuntu-slave and I see my ip address using "ifconfig" and it is 10.0.2.15. They both have the same address but they cannot talk to each other. 10.0.2.15 is the default address that virtual box assigns to any machine that is set up for NAT. If we want these two machines to talk to each other and be NAT'ed, we have to set up a separate new NAT network. Let's go to VirtualBox. Let's verify what we are discussing. Both of our VMs (two Ubuntu VMs) are set-up for NAT (which is default). Open VirtualBox Manager. Click on "Tools". Click on "Prefrences". Click on "Network". Click on "Plus" sign to create new NAT network. They call it "NATNetwork". Click on the gear icon to change the name to "TopGunNetwork" or "MyNATNetwork". Address Space --> Network CIDR: 192.168.100.0/24 We certainly want to support the DHCP. Next step is to add both Ubuntu-master and Ubuntu-slave to this new network. And they should be automatically assigned a new IP address in the 192.168.100.X space. I start with Ubuntu-master, I go to "Settings" of Kali. I go to "Network". It says "Attached to:" -- "NAT" here. We are going to change its "Name" from the dropdown to "NAT Network" that was created by us a minute back. Do the same thing for Ubuntu-slave machine. Now, try doing "ifconfig" on Ubuntu-master: you get 192.168.100.4 master@master-VirtualBox:~$ ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.4 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::9c46:b732:6918:fb34 prefixlen 64 scopeid 0x20<link> ether 08:00:27:ab:ba:4d txqueuelen 1000 (Ethernet) RX packets 28322 bytes 21509883 (21.5 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 21151 bytes 3096104 (3.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 16547 bytes 1408605 (1.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16547 bytes 1408605 (1.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Ubuntu-slave becomes: 192.168.100.5 And trying pinging the machines from each other. You can also try and ping "google.com" and see that your internet access is also still there.
Friday, November 26, 2021
Make Virtual Machines Talk to Each Other in VirtualBox
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment