Contact
- Slack: @nanjuan on wcscusf.slack.com
- Email: nestor@nntorres.com
Table
Prerequisites
- Have Network Adapter setuprunning
- If you have not setup your network adapter look here https://goo.gl/vs4cHC.
- Just copy the Prerequisites of peoples guides before yours here.
- Have your virtual environment configured
- Have the ISP gateway running.
- Have pfSense running.
Summary
The logical ideal of this tutorial is for you to be able to setup the ISP server for your lab. The ISP lab is the one that allow you to connect your other lab to the internet think at it as your internet provider at home.
Network adapters | Description |
---|---|
Adapter 1 | Leave it to NAT |
Adapter 2 | Change to Host-only (WAN Environment) |
VirtualBox VM Setup
- Go to Ubuntu and download the LTS server version.
- Install Ubuntu Server in Virtual Machine
- On Virtual Box go to top left corner to
New
to create the virtual box.
- Create the name of this Box recommended name
ISP Ubuntu
- In Type choose
Linux
if is not auto setected - In Version choose
Ubuntu (64-bit)
- On the memory section depending to your machine
RAM
capacity the minimun should be(254MB)
but if you have enough memory use(1024MB)
- Leave the Hard drive section as default which is
(Create a virutal hard disk now)
- Leave the Hard disk file type to
(VDI)
- Leave storage on physical hard disk to
(Dynamically allocated)
this will used the hard drive memory dinamically until it reach the max you gave it on the next step.
- For this machine the minimun for Ubuntu so it does not give you problem set the File location and
size to (20.00GB)
- After the Virtual Machine is created now you have to add the
ISO
that you download at the beginning - Go to Storage section and click on top that it say
[Optical Drive]Empty
- Then press
Choose disk image...
- Find the location where you download your ISO for Ubuntu Server.
-
On this step make sure you add the network adapters to the server
-
Right click
theISP Ubuntu
and clicksettings
- On network adapter one leave it to
NAT
- Then go to Network Adapter 2 and change the network adapter to
WAN Environment
like the picture bellow.
-
On this part start the ISP ubuntu virtual box to start the setup.
-
Click on the
ISP Ubuntu
then pressstart
Ubuntu Server installation
- The setup of the ISP Ubuntu on the photos bellow
- select you language
- Press enter on
Install Ubuntu Server
- Select the language again
- Select your location
- Press
no
on the Configure the Keyboard
- Select Keyboard language
- Select
enp0s3
which is theNAT
this might vary on your PC
- Set the
Hostname
of you VM machine to whatever you want
- Set the full name for
new user
- Then set your
Username
for your account
- Set the new user
password
- verify password again
- Select if you want to encrypt your home directory
I advice to select no for this test lab
- Select your
Time zone
if the one shown is correct press yes otherwise press no
- Select Partition disks select the
default
the one on the picture.
- Select disk partition the
default
- On the next step select
YES
on configure LVM
- Select the partition size
you need to leave it as default
- Press
yes
on write the changes to disks
Do not
set a proxy leave black and press continue
- The update question is all up to you. Can be setup to
no auto updates
orinstall security updates automatically
- On the
sofware selection
for this lableave default
- on the install the grub boot loader question select
YES
- On the last question select
continue
Ubuntu Server Configuration
- After Reboot log in into computer with the
username
you setup early and enterpassword
to log in
- First step run
sudo apt-get update
sudo apt-get upgrade
to make sure the system is up to date. - Enable ipv4 routing on Ubuntu. By default Ubuntu doesn’t allow for routing on IP traffic.
- To get this done you will need to edit
sysctl.conf
which is on the directory /etc/. - This can be done by using nano like so,
sudo nano /etc/sysctl.conf
. - It will require your
root password
since it effect the entire system when you edit this file.
- Go to the line that say
Uncomment the next line to enable packet forwarding for IPv4
and the remove the symbol#
by removing the#
sign this will make the program read and use that line toenable packet forwarding
.
- Then press
control+X
to save the config file on ubuntu and enterY
to confirm the file and safe the file
- Then press
Enter
to make sure the file name stay the same
- Next step run command
ip link show
to see which network interfaces are up it will look like the picture bellow - You should have you loopback
lo
and your network adaptersenp0s3
andenp0s8
or similars.
- You will need to add another interface to the server which is going to be the ip address for your lap to go into th einternet.
- Run command on the terminal
sudo nano /etc/network/interfaces
and enter your admin password
- Then you will see a text file like bellow
- Then add the new network adapter like bellow
- ISP sever network interface
auto enp0s8
iface enp0s8 inet static
address 172.31.11.1
netmask 255.255.255.248
up route add -net 172.0.0.0 netmask 255.0.0.0 gw 172.31.1.2
- Then press
control X
to exit andY
to save file then enter to leave the file with the same name do not change the file name
- run
sudo reboot
on the terminal this will reboot the machine and the seeting on the interfaces will take effect - Then run
router
on the terminal after it reboot it shout look like picture bellow
- Then run the next line on terminal this will add the new network adapter to your network route.
sudo route add –net 172.0.0.0 netmask 255.0.0.0 gw 172.31.1.3 dev enp0s8
- Then run
route
again to verify it took effect
- Then run
sudo services networking restart
to restard the network services nothing will display it only going to ask you for your admin password. This will restard your network services for the code above take effect.
- Then to verify everything is working fine run
ifconfig
the enp0s8 should have the infomation you enter like bellow
- Before running the following command run
sudo apt-get update and upgrade
andsudo apt-get install iptables-persistant
this will make the followin lines work correctly. - Then run this tree line on terminal like the picture bellow this will enable persistent on the iptables.
sudo apt-get install -y iptables-persistent
- Then on the next two question select yes like bellow
- Run next line bellow and password if ask it will not display anything after you run the line same as above is to make the iptables not reset.
sudo iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
- Run next line bellow and password if as and it will look like the picture bellows
sudo netfilter-persistent save
- Run next line bellow and password if as and it will look like the picture bellows
sudo netfilter-persistent reload
- After all this reboot Virtual Machine which can be done by running the following command
sudo reboot now
and move to next step pfsense setup.