In this post we will be seeing what is networking in Linux. Networking is a base thing and a core concept of each domain. It does not revolve around just Linux O.S but is applicable to many domains like Mobile applications, Cloud computing, Windows O.S, etc.
In O.S or Virtual machine, we first login into GUI/CLI to get the access of our O.S. Suppose, I want to operate ‘my systems O.S’ from my ‘mobile phone’ or if I’m running some command from my ‘mobile phone’ and I want this to get executed from ‘my systems O.S’, we have all the access in our ‘mobile phone’ but I don’t want to run from there.
If you want to pass any command, we have 2 ways:- 1.Remote access = Our O.S live in our company’s lab or data center, so normally we use this type of access. It is a union of hardware and software which sanctions the remote fit tools or particulars that commonly occupy on a network of IT devices. Using some other system and making the command to run on any other system is Remote host. 2.Local access = This is basically getting back information from users computer. We are using the O.S and working through that system only then this is called Local host.
In Networking, each P.C or O.S is known as Host. So, here ‘my systems O.S’ and ‘mobile phone’ are the hosts. Consider ‘my systems O.S’ as A host and ‘mobile phone’ as B host.
In Networking world, there are some protocols for making an action to happen. For example- For using some others website or web pages we use ‘http’ protocol. For downloading any file, we use FTP( file transfer protocol). For managing/sending the command in Remote host and want the output to come up, we use ‘SSH’ protocol(secured shell). We have many protocols with various uses like RSH, TELNET protocol.
Before moving further for this hands-on, we have to keep this things in mind- – You should check the internet connectivity, whether both systems are physically connected; either wireless or any kind of end to end connection. – Both systems should have IP address. For checking your phone’s IP address go to the phones settings > about device > status. You can also run this command to get the IP address of the connected phone.
$ route -n
– If still you won’t connect then ping each other i.e, check connection from both sides. Try to run ‘ping’ command to check whether both systems are ping or not.
If this things are done, we can proceed our VM’s through phone also.
We’ll connect our Windows O.S to mobile phone by allowing mobile hotspot and connecting the Windows using wireless with this hotspot.
Virtual Machine has its own network card called Bridging Network Card. Here, we have to permit this Bridging concept. To check the name of your network card; we have a command-
At the very first line you will get the network card name.
Whatever code/program you are going to perform, you’ll need a software. In mobile, software is primarily an app. If you want the VM to function on your phone, we’ll use SSH protocol to get connected to VM’s IP address. In the playstore, search ‘SSH’ and many apps wilol appear. For example, We’ll use Termius app; we’ll connect our VM by giving its IP address as host name as VM is our remote host.
For security motive, mobile phone will have to enter some details like:- IP address of VM/O.S Username and password of O.S Now you’re connected to VM. The screen appearing on your phone will be exactly like your O.S screen.You can also perform this same things on your VM.
Try to run any command, for example:- I have to kill the process Firefox, and I’ll run this command in my phone and it should execute in VM. Try to run this command from remote host.
$ killall firefox
-Error : no DISPLAY environment variable specified.
It happens because Firefox is a GUI based command which needs graphics, and this will show you error after running. For getting back and making this to run, use-
$ SSH -X 192.168.0.---- firefox
Firefox will start running successfully.
One thought on “Networking in Linux – Part 1”