Skip to content

Instantly share code, notes, and snippets.

@boseji
Created April 17, 2017 19:01
Show Gist options
  • Save boseji/44916afe1294d16cf09b13ed6b213c79 to your computer and use it in GitHub Desktop.
Save boseji/44916afe1294d16cf09b13ed6b213c79 to your computer and use it in GitHub Desktop.
NAT Config Work in progress

VM Configuration for NAT Local - DO NOT USE

We would be using a Windows PC with Virtual Box installed.

Also make sure that you have the latest Virtual Box extentions installed!

Adding a Local NAT network

First we need to add a Virtual Box NAT network for the given PC.

Open the Preferences from the Virtual box window.

Go to the Network Fold and select NAT Netowkrs Tab

And add the following:

Image of Prefernces for Networks

Configurer it as:

Image of Settings for Local NAT network

This would configure the NAT network.

Next we need to set the Local IP static for network interfaces.

Note until you finish configuring the Network adapters also this window should not be closed else settings would be lost.

Setting up Static IP

To Remove the Error we saw in the eariler image

Go to the Network Fold and select Host-only Networks Tab

Select each of the Virtual Box network adapters :

Image Selecting Network Adapter Config

Then configure each adapter:

Image Editing the Adapter settings

After doing a unique IP address for each adapter you can click OK button to save the settings.

Now this should display along with some WCL to change Adapter settings

Image Configuration process

Configure inside the VM

First we need to change the Settings in the Corresponding VM as follows:

Nat network configuration

Finally start the VM.

Then in Network Configuration change the following:

Network Configuration in Ubuntu

PORT Forwarding

One needs access to certian ports of the running VM.

This can be done by again going to Preferences from the Virtual box window.

Go to the Network Fold and select NAT Netowkrs Tab

Open the NAT Network details:

Editing NAT Port forwarding

Add a configuration:

Name: VM1SSH

Protocol: TCP

Host IP: <blank>

Host Port: 61022

Guest IP: 10.0.2.2 As per your configuration, in our case this would be the correct one.

Guest Port: 22

SSH Rule Added

Note Make sure to fix the address for the adapters (VirtualBox Host-Only Ethernet...) else the settings would not be saved. This is same as in the previous steps.


This setting allows to access teh SSH from outside the VM in the Host PC.

An Important catch here is that the Port 22 from the VM is mapped to Host PC Port 61022.

So its a tunnel access not direct access to the port. Hence on the PC side one needs to open 127.0.0.1:61022 to access the VM's SSH.

This completes the settings for VM to use a local NAT network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment