Virtual box NAT+ Host-only (static )

  1. Set the network adapter for Host-only NetworkVirtualbox-File-preference-Network
  2. Set the guest OS networkVirtualbox-GuestOS-Network
  3. Start the guest OS
  4. Edit /etc/network/interfaces as below.
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto enp0s3
    iface enp0s3 inet dhcp
    
    #static ip experiment
    auto enp0s8
    iface enp0s8 inet static
    address 192.168.27.101
    netmask 255.255.255.0
    
  5. Either restart the VM or run the below command to restart the network
  6. sudo service networking restart
  7. Now you should be able to perform ping or ssh from your host machine to this guest OS
  8. If SSH is not enabled in the server follow the below link to configure open ssh.  http://ubuntuhandbook.org/index.php/2016/04/enable-ssh-ubuntu-16-04-lts/
Advertisements