Usually, my virtual machines have a static IP address. This is convenient when you want to connect to a specific machine, for example, via RDP. But what if there’s no available pool of addresses? Port forwarding comes to the rescue.
Choose Your Virtual Machine and open settings.
Open Network Settings and choose correct adapter. Your adapter must be in NAT mode
Open Advanced settings and click button Port Forwarding
Add new rule. The rule’s name is optiona. Set the TCP or UDP protocol. Next step write correct port in column Host Port and Guest Port. Guest port is port inside Virtual Machine, Host Port is outside machine, the address of Your server.
After that You can use other port to connect with Your machine. Example: I can connect to SSH of Virtual Machine by port 2222.