Big Data, Data Analytics, IOT, Data Lake - Submit Your Guest Post
Linux Networking Commands Tutorial

Linux Networking Commands Tutorial

We will be learning about networking in Linux so before we move on with our article, What do you think when somebody says networking what would be the first idea which comes when you hear the word network so basically a network is a combination of a group of multiple computers which are connected.

 A group of interconnected computers is called a network so let’s say there are multiple computers with Linux running on them connected to each other and so you can call them a network now working on networking networks and handling them would be called networking.

The network is a group of computers interconnected and handling that and managing that would be called as networking so most of you would be doing a different course in order also you would be learning Linux but if you are going to become a Linux administrator a system administrator who mainly works on Linux servers then obviously you need to learn all of these concepts, 

First, the system administrator’s routine tasks include configuring maintaining troubleshooting, and managing servers and networks within data centers so if a particular system administrator is managing a data center that administrator should know all of these things, as well as he, should know how to handle networks within the data centers itself.

There are numerous tools and utilities in Linux designed for administrative purposes so there are so many different commands and tools which are already existing in the Linux system which can help you to network a system it can be a group of systems connected or just a single system that you can do networking now the four common tasks are configuring, maintaining, troubleshooting, managing servers and networks.

 Configuring in the sense of installing software and patching them up and updating the servers and then maintaining again comes around the same thing after you configure it you’ll have to maintain that software whenever there is a new update comes in you will have to do that immediately if there is a need so you’ll have to update the latest software keep you keep the server up to date and then troubleshooting whenever there is an error or a bug you will have to fix it immediately so that your servers can go to work so they don’t need to stop working.

Finally managing servers and networks so you’ll not be working on one single server so let’s say you have 100 servers so all the android servers should always have the same up-to-date information in them so you don’t need to go to every single server and maintain them because it is all connected in a network,

You will have a server from where you can manage the entire network and you can upload and download content from every single server, every single client from the server, and also update them directly from the server so for that you need to know how exactly to work with it so how exactly to manage those servers as well as the networks. Why do we need networking we saw what exactly is networking it is maintaining a group of interconnected computers so why do we need it first to share resources across the network.

Let’s say there are now coming to a real-time use case so let’s say we are working in a firm and all of us are using Linux for developing or whatever a company it might be selling a product or anything so everybody is using Linux and it’s interconnected so it is whenever you connect your ethernet cable that would be your LAN cable,

You will be connected to the network and everybody have a common shared public network so let’s say your building has five floors and there is a guy on the first floor trying to share some resources with a guy on the fifth floor now this guy doesn’t need to copy the files in a pen drive go all the way to fifth row give it to him and wait until he copies and get the pen drive back instead they are already connected in a network.

  He can just send the files directly through the network to the guy on the fifth floor he doesn’t even need to be connected to the internet he can directly send it using the LAN so that is why you need it that’s one of the reasons sharing resources and another thing is communicating across the network so you can make complete teamwork on it so Linux as you know multiple users can use in one particular Linux operating system so obviously multiple users if they’re using it you can communicate with other users.

 One of the reasons why do you need networking these are the two main reasons one sharing resources second one is communicating networking commands, first let me show you what are the commands we’ll be looking at in this article so we’ll be looking at if config and ping then we gate and curl ssh SCP and FTP so once we’ve seen that we’ll also look at firewall tools after that but first we’ll be looking at these seven different commands one would be if config then pings wk and curl SSHP and FTP so let’s get started with it.

First, we are going to look at if config now what exactly is if config command does so now kernel links up the software side to the hardware side using network interface so using this command you can configure them,

Obviously your system has software which is your operating system but that operating system is running on the hardware of your computer so now there obviously should be a connection between these two because only using the hardware you can configure a network because only through one hardware you can plug in the LAN cable but once you plugged in the LAN cable there should be software running which detects that so how can you do that so for that to configure that you use the if config command.

Let us see this as well so now you can see here a kernel links up the software side this was the thing and here you can check out just one particular port over here I’m just checking the enp 0 s3 port and it will give the netmask the broadcast it will give the mac id and you can see the ethernet mac and here the flag and what else dropped packets how many packets have been transferred if you see this packets and bytes so basically,

Internet connectivity is available and coming down sudo if down so you can basically down a particular connection I’ve downed this particular connection and I again activated that connection let me go to the terminal and let us try the if config command out so you can see I am connected to the internet so first let me disconnect and try the if config command.

 One second I’ll just make this a little smaller so that the command comes on the same page yeah so if config and now you can see there is an np 0s3 here these mini packages have been sent 5.1 4 MB this is the ethernet cable which I’m which I have connected and then you have the flag lo and virtual is flat so here there are no packets transferred you can see that over here no internet connectivity no packets transferred no internet connectivity let’s run if config once again so it’s the same.

  You can run f coin so if config a and p 0 is 3 and it only shows that particular port so now if this is the case now let me connect and let us run this command once again so you’ll have to wait until it sends more package packets so for that what we can do is we can open firefox so it’s not ready yet not now it’s ready,

Let’s do some just open google and do some things so that we can check the change here you can see this I did an update then also I installed my SQL so this is the total packet packets which I took in today so that’s what it’s showing after I logged in this is the number of megabytes I used now Mozilla is running so instead of going into Mozilla I’m going to just do a solo m update over here and a small update has occurred but not much and now you can see it is 5.6 MB because uh 0.2 MB of data has been transferred maybe it went out or maybe we downloaded it.

 when I opened Mozilla also opened the website it would have downloaded this HTML page and once it was downloading this it would have consumed some data that is the reason it is changing now.

 Now coming back to if config so first is your ethernet so that’s what it’s showing here and it has internet connectivity second is hello and this is your localhost and you can see the home address over here so localhost I have not connected to it yet so obviously there would be no packets transferred and this is the virtual boxes local IP address that is 192 1.6 sites and 1.122.1we’ve seen if config now let us check out the next command which is ping but before that, we will also do the if down and if up parts now sudo if down enp 0 s3 successfully deactivated.

 This obviously would have been deactivated and here you can see the internet connectivity was stopped I’ve started once again and I’ll run this once again and now you can see here the internet connectivity would have vanished you can check that once again by just going a little back once I have done this if down it would have stopped this particular port the ethernet port and the internet connector would have stopped if you want to start it again you can just use if up and now you can see the internet is connected over here and so this is how you can use the ifconfig command.

you’ll also get the IP addresses of your VirtualBox of your ethernet cable so you’ll get all of these IP addresses and then subnet masks using the if config command now next we will be looking at the ping command.

This would be the ping command, ping command has a lot of uses so the first basic use would be to check whether your internet is connected or not so I’ve typed in my system can send in a packet to telling that is are you connected with me.

if google acknowledges that and sends back a response then we will get this and you can see and you can see here 64 bytes from this particular location went to this and you can see the time to cost 19.8 milliseconds to receive and so pretty much that’s the case and that is ping in telepath and again I’m so it’s pretty slow because it’s not able to fetch information from because has a fire firewall Google is more of a public site but if I use it’s able to fetch it because this is the complete address and you can just click here and go to the website itself.

 You can check out how many packets were transmitted how many were received and you can see the packet loss you can see that over here so now let us do one more and this time I’m going to use the count flag so minus c 5 v,

Just check what will happen this time so this time it will only it only sent five packages sorry if I only sent five packets it checked whether the internet is connected or not that’s it for us so it just sent five packets received five packets simply because if you just run the ping command it’ll be running on forever and you’ll have to interrupt it to stop it, a way to check whether a community computer can communicate with another computer over the network.

The basic thing is not to check whether uh google has google can communicate with you or not obviously google can communicate with you can communicate with you because they are hosted in the net and they are servers the main task of the ping command would be if you have another server running which is connected in the same network you can type in the ping command and the address of it but I don’t have any connection,

I’m just running this because it’s my local IP and I’m able to communicate with my system, yes it is working so if I do an if config you can check that as well and you can see here the IP of my pc is this so that is the reason I run that so you can also run four it won’t because the net is one host not reachable.

 We do not have any server running in this particular IP which is point four so we were sent from one to this is the IP of my server to this particular server but this server does not exist so it is not able to reach that particular server and you can see it package transmitter to 0 received plus six errors so this particular system was transmitted eight packets but that server did not receive it and no was not able to acknowledge it.

That is the reason but if you do uh 192.168.15 it can fetch and you can see the time taken is also very very little it is because it is the same system it is pinging the same system and it is just checking whether it can communicate with it.

 This is one thing we have seen it’s a very good uh tool or which is a very good command ping now we’ve seen if config and ping coming down also here you can see I I’m thinking so I also want to show that so ping I’ll ping google.

While you ping this it will give you the IP so I don’t know why it’s okay so this is the IP address of google I’m going to copy this I’ll copy the IP of google and let me ping this and you can also see 10 received there was a small packet loss as well and if I ping this it’s working it’s the same as this but it’s working now let’s do one thing let us I’ll just open google chrome in my windows system and paste this IP here and this should take us to because that IP address is google’s IP address that is what our ping command is pinging and you’ll get the appearance of a particular system.

 Even if I ping in it’ll I’ll get the IP but the problem with this is I’ll copy this and paste it but I’ll not be able to use the direct IP address of dataflickr website because they are using cloud fare ray id that is they are using a very strong firewall,

Which I’ll not be able to use I’ll have to type in the domain name directly only then I’ll be able to view their website but obviously, their IP address is this now we’ve done the ping command let’s go back now let us check out wget and URL.

First, let us look at what command is used to retrieve content from web servers duplicate is a pretty common command used so let’s say you have a file in another server and you want to download it normally if it is a GUI if you’re using Mozilla firefox you just download that pdf by clicking on the download option in the viewer but if you’re using a command-line you will not be able to do that so to do that you can use the wk command you can use the w get command and after that just provide the link that will get will take care of everything it will download the file for you.

  I’ve opened the URL so I’ll just go here I’ll just copy this by clicking on enable editing so I’m just going to copy this because I’m going to download this pdf so let’s do an ls there are no pdfs like that so now w get and this so now this should download my file,

You can see here it so it is giving me the date and time it is giving me the I address it is giving its resolving docs. AWS. and website IP address is this and then it after resolving the IP is connected to that IP through port number 443 which is basically through HTTPS protocol and once it gets connected it sent an HTTP request and it was waiting for a response if the response is sent back it will send a 200 okay message so 200 okay messages in the sense the server is running successfully and you can download something from there you can download the file from there so once it is successful.

 Once the HTTP request is sent and the response is given and when the response is 200 then it shows you the size of the file and it downloaded the file and if I do an ls I should be seeing file over here so now I’ll just copy this IP and again paste it so it is taking me to because this is the IP address of that website.

Resolving this particular IP address in the sense this data that is and this IP address will be residing in a server so this particular server which is our server sent a request HTTP request to that server to check whether this particular name that is docs dot.

 This is the site right we did not have the IP address we just had the domain name so obviously, it has to resolve the IP address to download the file so we had the domain name that is so our server sent a request to the server which has this particular domain name and obviously once you’ve checked this particular domain name if that HTTP request is confirmed.

 This particular website domain name will have an IP address corresponding to it so that IP address will be retrieved back and given to you and then that IP will be used to log in and connect to it so let’s try this once again so I’ll paste this IP and type in 443 let’s see what happens because I cannot do that but it opens,

It connected using port number 443 but I will not be able to do that’s fine directly I will not be able to do that and we’ve used the w yet command properly and this is how you use the w gate command I’ll also show the state the difference between w gate and curl first let us let me show you this now URL a command to transfer data using various protocols.

 We can only do HTTP and HTTPS but URL can do every single type FTP TCP UDP and then also HTTP and HTTPS so URL can be used for every single type can be used for HTTP and HTTPS connections and it will be more useful.

I already have the domain name of dataflickr over here you can see this is a blog that is data science so I’m just going to download the contents of this particular domain name which is going to be the HTML content of this particular domain name once I’ve downloaded that if I open that file I should be able to see the entire content of the file downloaded.

Let’s try this the same thing I’m going to do the same thing I’m going to copy this and I’m going to paste it command not found, if the command does not know what exactly is the mistake now it should work and you can see this is how URL looks this is the total size received this is the received side so basically there was no loss of packets it was downloaded completely that is why the percentage is 100 and then average download 231 kb speed it got downloaded very fast so it’s not giving that.

If I do this there should be an file so now I’m going to open the intel.html file in nano and you can see the entire contents of it open no firefox and just open this particular file within that.

what URL is a command to transfer data between multiple uh various protocols so this is the only difference it is not a girl it curls and this is we get I think you understood these two tools so we have seen if config ping double gate and URL so if config can be used to configure the networks connected to your particular server and then ping is a command to check out the communication between yours and another server duplicate and URL command to download or transfer data we get is to retrieve data from web servers URL is to transfer data using various protocols between servers…

Dataflickr Team

Add comment

Your Header Sidebar area is currently empty. Hurry up and add some widgets.