Monday, February 01, 2016

Internet Connection Sharing in Ubuntu

For this setup, you'll need 2 physical network cards installed on your server - one connected to your Internet provider, and the second connected to a hub or second computer. Reference: Practical Ubuntu Linux Server for beginners


1. Go to the upper right corner of the desktop and right-click on Edit connections. Then rename your both connections using the Edit button as 'incoming' (Internet provider) and 'localnet' (home network). If you don't know which one(eth0, eth1, etc.) is which just unplug cables one by one to check. This step will save you lots of trouble down the process.

2.Choose to Edit the 'localnet' connection, click on tab: IPv4 Settings and for method choose: 'Shared to other computers'. Repeat the same procedure for the 'incoming' connection, but this time choose DHCP.

(if you are using PPPOE)
Click on DSL - Edit and type your username and password given by the Internet provider.

3. Next you'll have to enable the two logical connections followed by the DSL connection(if you use one) by just clicking on them. During the process notice if 'wired media is connected' message appears. If the media gets connected and quickly disconnects you can try to disable the IPv6 Settings on the 'localnet' by setting their method to 'ignore'.


Also, it's necessary not to let the NetworkManager setup the default gateway for the 'localnet' connection, so just do:
# sudo nano /etc/NetworkManager/NetworkManager.conf
and set its managed parameter = 'false'.


Same can be achieved if you click on 'localnet' connection Routes button and check the 'Use this connection only for resources on its network'. This way its default gateway won't get overwritten by the NetworkManager.


Finally turn on the internal firewall with the command invoked in terminal:
# sudo ufw enable
This way your server setup is OK, now for the computers that want to use Internet click on Edit connections and just give them the 'localnet' configured IP address as a gateway.

Cheers!

Thursday, January 28, 2016

Install latest Ubuntu version under VirtualBox and set up ssh

Here is how to install Ubuntu in a virtual machine "Virtual Box" and set up an ssh server. Reference: Practical Ubuntu Linux Server for beginners
First install the free version of Virtual Box from Oracle website: https://www.virtualbox.org/ . Then open the program and let's create a new virtual machine from the button new.
Note: Ubuntu requires around 10GB of disk space and please make sure that all visualization instructions and software code protections are enabled within your BIOS.
Then we download the latest Ubuntu version from http://cdimage.ubuntu.com/daily-live/current
Now is time to start the virtual machine and open up the Ubuntu .iso file. The installation will start, where is important to choose the root partition mount point/.
Here is how to do the installation:



After finishing installation it is time to install the networking, but first please update the system by opening a terminal (Ctrl+t):
# sudo apt update
# sudo apt dist-upgrade
If you wish to install ssh server and use it within your network, this can be done the following way: To install an ssh-server in a terminal type:
# sudo apt install ssh-server
Then we have to remove the built-in network manager(which will mess with the static IP addressing we need to set) via:
# sudo apt purge network-manager
At this point you may notice that other virtual boxes could not contact your machine, this is because you have to set the virtual box networking model. So open VirtualBox Ubuntu image settings and set the virtual machine networking from NAT to BRIDGED, which means that it can use private addresses and set up servers on. Warning this will stop your internet access. Then restart the ubuntu virtual machine and is time to set up our network so type:
# sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
this will set up your network interface card. If you want to make the changes persistent on the next restart you can place this information in /etc/network/interfaces file:
# sudo nano /etc/network/interfaces
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.255

next you can do the same steps for other virtual installations of Ubuntu.
and try to connect to 192.168.0.1 via ssh client
# ssh 192.168.0.1 -l username

That's it. Enjoy learning !

Subscribe To My Channel for updates