= !VirtualBox and Virtual Machines Configuration = In this Hands-on you will create two seperate ubuntu virtual machines. These VM's will be used to install network monitoring systems and tools. == Setting up the Virtualbox == === Installation of !VirtualBox and Downloading virtual hard disks === - Download and install !VirtualBox 5.0.x​ - Download the Virtual Hard disks from the LEARN mirror. You can get them by following links * [http://192.248.4.49/NetMon/NetMon.vdi NetMon.vdi] - Note down the location of downloaded vdi files === Creating the VM !NetMon === - Start !VirtualBox and Click on '''New''' button (at top-right) to create new virtual machine - Enter name of the VM as '''!NetMon''' - Select OS Type: '''Linux''' - Select Version: '''Ubuntu (64-bit)''' - Then click on '''Next''' button - Set VM's memory size to '''1024MB''' and click on Continue button - Set VM's hard disk option to '''Use an existing virtual hard disk file''' and click the browse button and browse to the location where you download the virtual hard disks. Then select the '''!NetMon.vdi''' file and click on the create button. - You will see a new virtual machine named !NetMon appears on Virtual Box Manager Window ==== Setting up Network Interfaces ==== - Select the !NetMon VM from left panel on Virtual box, right click and open '''Settings''' - Click on the '''Network''' title - On '''Adapter 1''' check the '''Enable Network Adapter'''. Then change '''Attached to''' to the '''Bridged Adapter''' and make sure the '''name''' of the interface is the same interface which you use to connect to the outside (Either Wi-Fi or Ethernet). This virtual interface will work as the WAN port of the of your virtual campus network that can be used to connect from outside. - Click on '''Advanced''' drop down list and change the '''promiscuous mode''' to '''Allow All''' - Click '''OK''' ==== Adding processors ==== - Select the !NetMon VM from left panel on Virtual box, right click and open '''Settings''' - Click on the '''System''' title - Go to '''Processor''' tab and set processors to '''2''' - Click '''ok''' == Create the Second VM == For the next two days of the workshop, you will need another linux box. Instead of Installing OS we can clone your VM and create a new VM. You can easily create the second VM using VM cloning. This VM is for your LibreNMS network monitoring system. Right click on the VM to select Clone option Assign new name as LibreNMS Check "Reinitialize the MAC address for all network cards And then click on Continue Select Full clone This might take some time to create the new virtual disk image (vdi) file. Note that your new VM is same as your previous one. You have to change the host name, IP addresses, etc accordingly. === Setting Up IP Addresses === ==== !NetMon VM ==== - Select the '''!NetMon''' VM from left panel on Virtual box, right click '''Start''' and wait till the VM starts - Login to the machine using the following user credentials {{{ usrname : admin password : }}} - Then change the '''interfaces''' file. Root password is the same as class password {{{ sudo vi /etc/network/interfaces }}} - locate the following lines {{{ iface enp0s3 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.56.254 dns-nameservers 192.248.1.161 }}} - Change it to the following lines. You can find your IP Address from this [wiki:2017netmonipallocation table] {{{ iface enp0s3 inet static address netmask 255.255.255.0 network 192.248.6.0 broadcast 192.248.6.255 gateway 192.248.6.254 dns-nameservers 192.248.1.161 }}} - Save and Exit the editor (type ''':wq''') - When you completed the IP settings , reboot the machine {{{ sudo reboot }}} - Confirm the correct IP settings by '''ifconfig''' command. Your result should be something like the following. Check the IP address of enp0s3 Interface and see whether the other interfaces are up {{{ enp0s3 Link encap:Ethernet HWaddr 08:00:27:8c:e0:26 inet addr: Bcast:192.248.6.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe8c:e026/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1120 errors:0 dropped:0 overruns:0 frame:0 TX packets:7550 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:99387 (99.3 KB) TX bytes:567441 (567.4 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) }}} - Try ping to some known hosts and see the results. {{{ ping 192.248.6.254 ping 192.248.1.161 ping www.google.com }}} ==== LibreNMS VM ==== - Select the '''LibreNMS''' VM from left panel on Virtual box, right click '''Start''' and wait till the VM starts - Login to the machine using the following user credentials {{{ usrname : admin password : }}} - Then change the '''interfaces''' file. Root password is the same as class password {{{ sudo vi /etc/network/interfaces }}} - locate the following lines {{{ iface enp0s3 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 dns-nameservers 192.248.1.161 }}} - Change it to the following lines. You can find your IP Address from this [wiki:2017netmonipallocation table] {{{ iface enp0s3 inet static address netmask 255.255.255.0 network 192.248.6.0 broadcast 192.248.6.255 gateway 192.248.6.254 dns-nameservers 192.248.1.161 }}} - Save and Exit the editor (type ''':wq''') ==== Setting the Hostname and FQDN ==== Login to the vm. change to root user {{{ $sudo su }}} Give your password Edit /etc/hostname {{{ #nano /etc/hostname }}} Change !NetMon to LibreNMS Save and Exit also edit /etc/hosts file to change 127.0.0.1 !NetMon to 127.0.0.1 LibreNMS When you completed the IP settings , reboot the machine {{{ sudo reboot }}} Confirm the correct IP settings by '''ifconfig''' command. Your result should be something like the following. Check the IP address of enp0s3 Interface and see whether the other interfaces are up {{{ enp0s3 Link encap:Ethernet HWaddr 08:00:27:8c:e0:26 inet addr: Bcast:192.248.6.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe8c:e026/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1120 errors:0 dropped:0 overruns:0 frame:0 TX packets:7550 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:99387 (99.3 KB) TX bytes:567441 (567.4 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) }}} Try ping to some known hosts and see the results. {{{ ping 192.248.6.254 ping 192.248.1.161 ping www.google.com }}}