Configuring a Static IP for VirtualBox VM in Ubuntu along with Internet Connectivity in Virtualbox

Leave a Comment

Configuring a Static IP for VirtualBox VM in Ubuntu along with Internet Connectivity in VirtualBox


If you have provisioned any Ubuntu Server/VM running using Oracle Virtual box and want to have both static IP and Internet connectivity enabled. This is the right place for you to learn how to make the required configurations to achieve this.

For this task, we will need to add two Network adaptor , If you also need your VM to have internet access as well, leave Adapter 1 as NAT and enable Adapter 2, configured as a Host-Only adapter. This will allow your VM to connect to the internet using NAT as well as make a local connection to your Host using Host-Only.

1.  Adaptor 1 - NAT

2. Adaptor 2 : - Host only adaptor


Steps:

1. Shutdown/ Power off  the VM 

2. Go to the VM settings and Select adaptor 1 as NAT as shown in the below screenshot.





3. In the advanced setting, select the port forwarding and configure port forwarding as below

for the 'NAT'. I clicked the 'port forwarding' option at the bottom of the screen. I gave it a name 'PuTTY-port-fwd', protocol TCP, host IP 127.0.1.1 host port 2222 guest IP 10.0.2.15 guest port 22. I then launched PuTTY and set it to 127.0.0.1 port 2222 and it connected to my ubuntu vm







4. Power on the VM and let it boot until login prompt  is available , Open any putty terminal,  i use mobaxterm for the ssh access.

Verify ssh access using ssh -p 2222 himanshu@127.0.1.1



Booyeah!  you have successfully configured your Ubuntu VM to be accessible via Putty session along with the internet access.

I hope this post was helpful for you.

Also read : 




0 comments:

Post a Comment