This note will describe the process to connect Oracle Virtual box VM directly from your host using ssh as well as from VM to internet connection.
I will use 2 types of VM interface.
a)NAT network for internet connection from VM
b)Host only adapter for ssh connection from host to the VM.
Step 1:-First I will go to File->Preferences and check/create NAT network with below settings in Oracle Virtual box :-
Step 2:-Create host-only network as well
DHCP server should not be enable here
Step 3:-Please create first network interface (NAT)
Step 4:-Please create host-only adapter interface
step 5:-Please check persistent rules under /etc/udev/rules.d and modify mac address if possible.The MC address should be same which was visible in step 3 and step 4
Step 6:-Please create ifcfg-eth1 and ifcfg-eth2 using below settings.ETH1 is for NAT and ETH2 is for host-only adapter.Please check HWADDR value as MAC address in previous steps.
Step 7:-Now reboot your VM or restart individual Network interface (eth1 and eth2) using ifup or ifdown command.
Step 8:-Please check ifconfig -a
step 9:-Please enable root login
enable PermitRootLogin to yes in /etc/ssh/sshd_config.
[root@rac1 yum.repos.d]# service sshd restart
Redirecting to /bin/systemctl restart sshd.service
Step 10:-Now you can check whether you connect to host using IP 169.254.156.100.You can also check ping to google.com after login to VM