How to set and run NAT Virtual Network on CentOS,Kali Linux, Windows in VirtualBox. Practical example .
Network Address Translation (NAT) Virtual Network in Virtualbox
This post will cover practical example of Network Address Translation (NAT) network settings in Virtualbox . NAT is the default network configuration for any guest operating system (OS) in Virtualbox, . This setting will allow virtual machine connect to internet and user can browse and use the machine as a normal computer.
Virtualbox networking engine, will assign every guest OS with an IP address . Virtualbox networking engine treat each guest operating as a separate private network and they can't communicate with each other .In addition to that the IP address assigned from Virtualbox Networking Engine is unreachable from outside (internet).
A guest OS with NAT enabled will redirect it's data through a Virtualbox Networking Engine.Virtualbox will then maps the data using the host Wireless/Ethernet card and then will redirect to guest operating system. In other words, virtual box networking engine will extract TCP/IP frames and will redirect to each guest operating system.
Below is the environment that I use for this tutorial
- Ethernet/Wireless router
- Ubuntu ( Virtualbox Host )
- Kali Linux (Guest OS 1)
- CentOS (Guest OS 2)
- Windows(Guest OS 3)
Virtualbox NAT Network Diagram
Below diagram shows NAT network topology in Virtualbox.Kali Linux, CentOS and Windows connection only happens virtually where there is no physical wiring between them . Each connected guest OS will get it's IP address assigned from Virtualbox networking engine .
NAT Virtualbox setting
1) By default NAT setting is pre configured in Virtualbox ,You can view this setting under "Settings>Network"
Because each guest OS will be on their own private network,you can use similar adapter settings for all three guest OS. These guest OS will get similar IP address because of this.
2) Run Kali Linux, CentOS and Windows guest operating system
3) All three guest operating system will get a similar IP address of "10.0.2.15" .
Windows IP |
CentOS IP |
Kali Linux IP address |
As you can see in above example, virtualbox networking engine treat all three guest OS as different entity all together running on their own private network. None of these guest OS are connected and they can't communicate with each other.
Guest Operating System IP address with different adapter setting in Virtualbox.
In this example ,I set different adapter setting to each guest OS and different IP address is assigned to each guest OS.
1) Adapter 2 to Kali Linux guest OS . Kali Linux gets "10.0.3.15" IP address
2) Adapter 3 to CentOS guest OS .CentOS gets "10.0.4.15" IP address .
CentOS IP address |
3) Adapter 4 to Windows guest OS.Windows gets "10.0.5.15" IP address .
Conclusion
- NAT configuration will allow guest OS connect to the internet and work as a normal computer
- Guest OS with NAT enable configuration are not connected with each other.
- Different adapter setting will give different IP address to connected guest OS respectively.
- Guest OS is unreachable from Wide Area Network (WAN)
For more information on this topic,please visit here