vlan inside virtual box using openvpn__bdk_documentation5

Post on 16-Jan-2016

224 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

VLAN Inside Virtual Box Using OpenVPN

TRANSCRIPT

Documentation for establishing a VLAN inside Virtual Box using OpenVPN Server:

Suggested minimum requirements:

(1) 2GHz or above CPU speed (preferably 2+ cores)

(2) 3GB RAM or more

Images available are:

(1) Ubuntu Desktop with OpenVPN Server preinstalled and preconfigured (this is a simple image for

your own experimentation)

(2) Ubuntu Desktop with JVM and OpenVPN Client preinstalled, and Ubuntu built-in firewall

preconfigured (only allow traffic on port 10000) (use this image for VPN client A)

(3) Ubuntu Desktop with JVM and OpenVPN Client preinstalled and Ubuntu built-in firewall

preconfigured (only allow traffic on port 10000) (use this image for VPN client B)

Overview of the steps required to establish a totally virtualised LAN inside Virtual Box:

(1) Install VirtualBox on your real machine (host)

(2) Mount the OpenVPN Server image into VirtualBox and boot up the Virtual Machine.

(3) For each client Ubuntu image, mount the Ubuntu Desktop image and boot up the Virtual

Machine, log in to the OpenVPN server and download a client configuration, launch OpenVPN

Client using the client configuration file you’ve downloaded.

Detailed Steps:

(1) Installing VirtualBox:

(a) Download VirtualBox 4.0.4 from this URL http://www.blueicon.com/uploads/VirtualBox-

4.0.4-70112-Win.exe

(b) Start the installation by opening your downloaded .exe file, then you will see the screenshot

below.

(c) Click on Next, then you will see this

(d) Leave everything at its default, and click Next, then you will see this

(e) The above 2 options is up to you, click Next, then you will see this warning saying that you

will get a disconnection from the Internet and LAN during installation.

(f) Click on Yes to continue, then you will see this

(g) Click on Install to start the installation, during installation, you will get a series of these

warnings, click on “Continue Anyway” for all of them.

(h) This is the last step of installation, you will see this

(i) Leave the checkbox ticked, and click on Finish, then VirtualBox will automatically launched.

(2) Mount the OpenVPN server image and boot up the Virtual Machine:

(a) Download the OpenVPN Server image from this URL

http://www.blueicon.com/uploads/OpenVPNServer.vdi , the file name is

OpenVPNServer.vdi

(b) Launch VirtualBox and you will see the main interface of Virtual Box

(c) Click on “New” in the picture below

(d) Click on Next when you see this

(e) Give a name/description for your Virtual Machine, e.g. OpenVPNServer, Choose “Linux” for

the Operating System, and choose “Ubuntu” for Version, then Click Next

(f) Leave the memory as default, i.e. 512MB, click next

(g) Tick the check box “Boot Hard Disk”, choose “Use existing hard disk”, and click on the

browse button to locate your downloaded OpenVPNServer .vdi image file , then click Next

(h) Click Finish

(i) Highlight the OpenVPNServer Virtual Machine on the left, and click on Settings

(j) Below are the settings required for the OpenVPNServer, these settings are a must,

otherwise you might have to reconfigure the server. Click on the Network tab on the left,

for Adapter 1, check “enable network adapter”, choose “Host-Only Adapter” for Attached

To, choose “VirtualBox Host-Only Ethernet Adapter” for the Name, LEAVE THE ADAPTER

TYPE AS DEFAULT, VirtualBox will default to the one which suits your hardware. Type in

080027EC4768 for the MAC Address, this setting is most important in order for the server to

run at startup. Check the tickbox for “Cable Connected”

For Adapter 2, check “enable network adapter”, choose “NAT” for Attached To, LEAVE THE

ADAPTER TYPE AS DEFAULT, VirtualBox will default to the one which suits your hardware.

Type in 080027C83172 for the MAC Address, this setting is most important in order for the

server to run at startup. Uncheck the tickbox for “Cable Connected”. Then click on OK.

(k) Start the Virtual Machine by clicking Start.

(l) After the machine got booted up, we need to check whether the OpenVPN server is running

properly, and also we might need to change one setting in the Admin panel. Click on the

Firefox browser icon on the top bar.

(m) Click on the “OpenVPNServer Admin” bookmark on the bookmark bar.

(n) The URL of this bookmark is https://localhost:943/admin/ , if the OpenVPN server is running

correctly, you should see this Administration panel login. If you see something like “cannot

connect”, then one of your previous settings is not correct.

(o) Type in “openvpn” as username, “blueicon” as password. We only need to check if one

setting is correct, which is the local IP address has to be the same as the IP address which

the clients connect to. When you logged in, check that the OpenVPN server has started by

clicking “Status Overview” on the left panel. Now click on “Server Network Settings” on the

left panel, the IP address in the text field must be the same as the one shown below it, if it’s

not, then you need to change it to the IP address under the text field box, and click on “Save

Settings” at the bottom of the page if you need to change it.

(p) If you have made a change to that IP, you must do the following:

(q) Once you clicked that, it should say “Running Server Updated”, like in this screenshot

(r) That’s all for the OpenVPN Server.

(3) Mount an image for one of the nodes and make a connection to the VPN server as a VPN client

(a) Download Ubuntu NodeA.vdi from this URL (

http://www.blueicon.com/uploads/Ubuntu NodeA.vdi )

(b) Click on New to add another image hard disk

(c) Click Next

(d) Type a name/title for your Virtual Machine, e.g. Ubuntu NodeA , choose Linux for the

Operating System, and Ubuntu as the Version, then click Next

(e) Leave the memory as default, i.e. 512MB

(f) Check “Boot Hard Disk”, choose “Use existing hard disk”, click the browse button to locate

your downloaded .vdi image file, then click Next

(g) Click Finish

(h) Highlight the image you just created, click on Settings

(i) Click on “Network” on the left panel, we only need one Adapter here. Check “Enable

Network Adapter”, choose “Host-only Adapter” for Attached to, choose “VirtualBox Host-

Only Ethernet Adapter” for Name, leave the Adapter Type as default, no need change the

MAC address randomly generated by VirtualBox, make sure the “Cable Connected” is

checked. Click OK

(j) Click start to start this virtual machine

(k) We are now up to the step to connect this virtual machine as a VPN client to the OpenVPN

Server. Click on the Firefox icon on the top to open the Firefox browser.

(l) On the URL, type in https://IPAddressOfOpenVPNServer:10000 , this is the IP Address you

saw when you logged into the OpenVPN Server Administration page. When you go into this

page, you will see a warning.

(m) Scroll down to the bottom, and click on “Add Exception”

(n) Uncheck “Permanently store this exception”, then click on “Confirm Security Exception”

(o) I have created 10 users in the OpenVPN server, usernames are node1, node2 ….. etc, and

the password are all the same, which is “blueicon”. Type in “node1” as the username, and

“blueicon” as the password. Choose “Login”, and click Go.

(p) You will see a page like this

(q) Scroll down to the bottom, and download the VPN client configuration file by left clicking

“Yourself (user-locked profile)”

(r) When the download pop-up box comes up, Choose “Save File”, then click “OK”

(s) We are now ready to connect to the OpenVPN server by using the downloaded

configuration file. Open a terminal window by clicking Accessories, then Terminal.

(t) Connect to the OpenVPN server by typing this command: sudo openvpn -config

/home/blueicon/Downloads/client.ovpn

(u) The you will be prompted to type the Administrator password, the password is “blueicon”.

(v) Then you will be prompted for a username and password for logging into the OpenVPN

server, type “node1” as username, and “blueicon” as password.

(w) If you see this message “Initialization Sequence Completed”, that means you have

successfully connected to the OpenVPN Server as a VPN client.

(x) Repeat all these steps for adding another VPN client to your VLAN, except for the step when

you go to download the client configuration file, log in as “node2”, same password. The URL

to download VPN Client B is here (http://www.blueicon.com/uploads/Ubuntu NodeB.vdi).

Appendix

Change Rules in firewall

Even though the firewall in the VPN client node images

are preconfigured to allow only traffic for port 10000, the

below screenshot shows how to change the rules in the

firewall.

(a) Click on System, Administration, Firewall Configuration

(b) You will then prompted to type in the Administrator password, which is

“blueicon”

(c) This is the GUI for the firewall configuration, which can be downloaded

from issuing this command in the terminal: sudo apt-get install gufw

top related