Tech Junkie Blog - Real World Tutorials, Happy Coding!: Computer Networking

Latest Posts

Showing posts with label Computer Networking. Show all posts
Showing posts with label Computer Networking. Show all posts

Monday, August 9, 2021

 The most common way to troubleshoot a networking issue is to trace the sending and receiving of packages between hosts.  Almost all OS has this kind of command and Linux is no exception.  In Linux we use the traceroute command to trace the package from point A to point B.

To use the command you basically type the command traceroute and then the hostname for example if you want to trace the route to www.google.com you simply type traceroute www.google.com

If you don't have the command install you can install it by typing the following command dnf install traceroute -y












So now let's run the command traceroute www.google.com and see what happens





As you can see it starts with the gateway then each hop is labeled with a number.  You can see when hops takes the longest and see the bottleneck in your network.

Monday, July 19, 2021

 Sendmail is the most common Linux mail service, it is lightweight and is used in administrative tasks as well as sending mail.  In this post we are going to install and configure Sendmail and go over how to use it. Sendmail is the mechanism to send mail, it's not the mail server itself.

First let's install the Sendmail service, type dnf install sendmail -y after sendmail is installed you can install another package which will configure sendmail for you, type dnf install sendmail-cf -y to install that package




















One it is installed you need to define your smtp relay server in the file /etc/mail/sendmail.mc file in the line that says dnl define(`SMART_HOST', `smtp.your.provider')dnl this is the one service that you need to have some infrastructure in place before you can use it.  Remember to remove the dnl when you specify the smtp server because dnl means comment in the sendmail.mc file.

Once you have your smtp relay server defined, you can start the sendmail service with the systemctl restart sendmail command

To send an email you type
mail -s "subject goes here" johndoe@gmail.com then press ENTER

message goes after ENTER then press CTRL+D to exit and sendmail

 

Monday, July 12, 2021

 Now that we have a good understanding of how time works in a Linux ecosystem.  We want to sychronize our time with the chrony package.  There's also the ntp package but it's been deprecated so the way to do this right now is the to do it with the chrony package.

Here are the steps to synchronize time with chrony:

1. First you wan to install the package by running the command dnf install chrony -y it might already be installed

2. Once it's installed type the command systemctl enable chronyd and systemctl start chronyd to start the time sychronization

3. If you want to see more information about the time synchronization on the server you can run the chronyc tracking command





















As you can see our current Stratum level is 3, which is pretty decent.

Another useful command that you can run is the chronyc sources command, this command will show you want servers you synchronized against.






You can add or remove the servers in the /etc/chrony.conf file in the top section, which should have iburst in it.

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

pool 2.centos.pool.ntp.org iburst

Monday, July 5, 2021

 NTP stands for Network Time Protocol, in a nutshell what this service does is that it synchronizes your servers so that communications is reliable between servers.  The reason NTP is needed is because there are three types of time in computer networking.  They are the following:

  1. Hardware time
  2. System time
  3. NTP
The first two types of time are not reliable by nature because it could be set by people or it could be wrong.  So there's NTP time which is synched to the internet, which we always trust because the internet never lies.  For example a system admin can use the date --set command and set the wrong time.  This is crucial if you have network peers.  You can use the date and hwclock commands to the display the system time and hardware time respectively


You can use the command hwclock --systohc to sync the hardware time to the system time or hwclock --hctosys in the reverse direction, but as you can see from the scenario the system time can be manipulated and set incorrectly.

NTP is graded by Stratums with a scale, yeah buzzwords! So if you have a stratum of 1 that means you are the champ you are at atomic clock synchronization, and if you are at 16 you are a chump!  Best explanation ever!

Anyways to check if you are using NTP you can type the timedatectl status on the terminal





As you can see I am a champ, because the timedatectl status command tells me that my system clock is synchronized and my NTP service is active, and if you say otherwise, "I will break you!".  It's my blog sorry.  Besides showing the status timedatectl is also useful in setting the time it will check to see if the time you set is reasonable for instance you can set the time to 1999 because you wanted to party like it's 1999.  Let's see what happens time using the command timedatectl set-time "1999-01-01 00:00:00" 



As you can see the NTP service will not allow you to party like it's 1999 it will give you a message that says set time command failed because NTP is active.  So it gives you a nice reminder that life is not one big party. With Linux you have total control for the most part so you can turn off ntp with the command timedatectl set-ntp false and then party like it's 1999.  But why would you want to do that?


Monday, June 28, 2021

 The dig and nslookup commands are useful commands that you can use to lookup information about a network.  The dig command gives you more information about a network.  For example for my network I have a DNS server setup in it, if I wanted to display the DNS information on my server I would simply type dig masterdns.acmebanking.com and I would get the following:













As you can see it gives you a lot of information about the DNS server like the IP that the server resolves to.  However, there are times when you just want something quick and brief on what the IP resolves to. For example you might know the IP address but not the hostname or vice versa and you want to lookup the information on the part that is know that's when nslookup comes in handy.  For example let's say you know the IP address 192.168.0.15 but you don't know the hostname.  You can lookup the hostname by typing nslookup 192.168.0.15 and you would get the hostname that resolves to the IP address




Or you can lookup the IP address with the hostname by typing nslookup apps.acmebanking.com




Obviously you can get more information with the dig command but sometimes it's nice to get less information with the nslookup command.  Although it is deprecated and might not be available for your Linux distribution. So if it's not available use the dig command instead.

Monday, June 14, 2021

 Now that we have a static IP setup for our network.  We want to use it as a DNS server.  Let's go over the steps again for configuring a DNS server and make sure that eveything works with the static IP.  The key is the make it work on reboot.


Before you do anything get the name of you network adaptor and the IP address for it, my network adapter is enp0s3 and my IP address is 192.168.0.14.  Yours will be different

You also want to know the hostname of the server for the configuration, you can find out what the hostname is by typing hostname

If you want to change your hostname you can follow the instructions on this post 

Make sure you have the following information in the /etc/named.conf file








Monday, June 7, 2021

 In the previous post we configured a DNS server, in this post we are going to assign a static IP to that server so that we don't get a new IP everytime we reboot the server.

First let's check our VirtualBox Adapter IP settings

1. Make sure your VM is set to the Bridge Network setting




Now turn on the VM machine and type ifconfig to the the adapter name

First let's get our network information with the command ifconfig 




Monday, May 31, 2021

 In this post we are going to to go over how to install and configure the DNS capability in our Linux server.  A DNS server translate IP addresses into hostnames.  When you type in google.com in the backend it actually maps to an IP address on the internet.  Therefore DNS is at the heart of the internet but you don't know that you are using it.

Here are the steps to configuring a DNS server on a Linux server:

Before you do anything get the name of you network adaptor and the IP address for it, my network adapter is enp0s3 and my IP address is 192.168.0.14.  Yours will be different

ifconfig command on terminal session

You also want to know the hostname of the server for the configuration, you can find out what the hostname is by typing hostname

hostname command on a terminal session




Monday, May 24, 2021

 When you are planning and configuring your server farm, one of the most common task will probably be changing your server names to fit your organization's naming convention.  In this post we are going to change one of our Linux hostname with the hostnamectl command.  Here are the steps to change your Linux hostname.

1.  Open a terminal session on the host that you want to change the hostname, then type the command hostnamectl the hostname information will be displayed, as you can see the hostname is currently localhost.localdomain


2.  Let's see we want to change the name of the server to dc.acmebanking.com because this is the server for our company ACME Banking Inc.  and we want this server to be the domain controller hence the letters dc. to label it as the domain controller.  Some people like to be creative and use movie characters or attractions as the server names.  It's a matter of preference, but I like to look at a server name and know exactly what it's for.  But it's really up to you.

3. Now what you want to do is type in the following command, to change the hostname

hostnamectl set-hostname 'dc.acmebanking.com'

4. Type hostnamectl again to verify that the hostname has been changed



Search This Blog