You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Prerequisites

  • Ubuntu 16 running in VirtualBox

VirtualBox Prerences

In VirtualBox Preferences define Host-only adaptor (should already exist and default to the following)

  • Ip: 192.168.56.1
  • Netmask: 255.255.255.0
  • DHCP: Enabled

Create K8Master

Create VM with

  • 2 GB MEM
  • 10 GB disk
  • user: test


Install SSH

> sudo apt-get install openssh-server


Determine your network interface

> ifconfig

enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ff:1a:7b  
          inet addr:192.168.56.3  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feff:1a7b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:168 errors:0 dropped:0 overruns:0 frame:0
          TX packets:244 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14463 (14.4 KB)  TX bytes:21919 (21.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)


From the above we can see that our vm is running with IP: 192.168.56.3

Let's make it a static and assign it 192.168.56.100.


> sudo vi /etc/network/interfaces

# 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 static
        address 192.168.56.100
        netmask 255.255.255.0
        network 192.168.56.0
        broadcast 192.168.56.255
        gateway 192.168.56.1
        dns-nameservers 192.168.56.1 8.8.8.8


> reboot


After reboot, we should be able to confirm that the ip address is static by issuing the ifconfig command once more.


SSH into your VM from your host:

> ssh 192.168.56.100






Reference

  • No labels