Hey folks and welcome to manage a Linux networking lecture.
What we will learn in this lecture is the static versus dynamic IP.
We'll cover OS network components such as network interfaces, subnet mask, gateway, MAC addresses,
DNS and so on.
We'll also cover how the network manager works.
What is a network manager and why it is used for?
Then we'll cover the number, configuration methods and the commands for those network configuration
methods like NMT, UI, NM, CLI and MX Connection Editor.
And we'll also cover the genome, the desktop environment setting.
There can be access to the GOOEY.
And the last thing that we'll cover in this lecture is about network files and the basic commands.
Now, as a Linux system administrator, you should know the basic command to manage your Linux environment
or Linux networking and also to troubleshoot any network related issue.
All right.
So let's go in straight into the static versus dynamic IP.
Static versus DHCP.
First of all, DHCP stands for or insured for a dynamic host control protocol.
So if an IP is not static, it is referred to as DHCP.
So first is IP itself stands for internet protocol.
I'm sure you know that which is assigned to your computer so it can access the network.
Now, there are two types of IPS that could be assigned.
One is private IP that is assigned for internal communication that is within your own network.
And then there's a public IP.
It's for the Internet or external communication or going to the Internet or search the Internet.
Okay.
So static IP.
And in short and simple words is anything that is assigned to your computer that does not change.
Meaning you reboot your computer, you reconfigure it, you have it shut down for a month.
It will have that IP manually configured to your computer.
And then compared to DHCP dynamic, it changes every time your system reboot.
Now why do we have static versus dynamic?
The main reason is static IP is assigned to computers like a pre-production computers, so it has its
hostname IP assignment as a DNS set up.
If there are computers outside in the world that are accessing it, you don't want that your computer
IP to change because if you're if it's changing every day, then it's going to be so much confusion
to find out what is your IP address.
Whereas dynamic IP, if you're running in the local lab environment, you don't really care what IP
is given as long as you could access it.
That's what really matters.
All right.
Let's look at our Linux machine and we could view how we could access our IP address.
All right.
I have logged into my Linux machine through putty terminal and the command that you can run to access
the IP is if config and it will give you the three interfaces.
One INP zero se three.
This is the interface that's given when you are running an Oracle virtual environment, then I'll give
you this low.
This is local.
It will always be the same, always have the same IP.
Your processes in your inside of your computer.
The that those processes if they have to communicate between each other, they use this interface to
communicate.
And then we will have a virtual bridge adapter that's given.
When we created that on the virtual environment, we could definitely ignore that.
The one that we have to focus is this 110 to 53, 1.17.
This is the IP is given to my computer, my Linux machine and it is not static, it is DHCP and it could
change if I reboot my linux machine.
All right.
Your IP could be different than mine.
It doesn't really matter.
What matters is that you're getting or pulling the IP address.
So I use the command if config if you do not have the if config command because a newer version of Linux
that I have config command has been deprecated.
You could use a newer command which is IP space, a DDR, which will also give you all the interfaces
right here.
This is low.
The second interface in p03 and the third interface virtual bridge.
So our focus is this one and the IP address is looking at it right now, 10 to 53, 1.17.
All right.
So that's pretty much about static and basic.
If you are running any production, application or processes on your Linux machine, my recommendation
is that you assign a static IP to your machine.
All right.
Moving on to the next one, which is operating system network components.
The very first components we should cover is a network interface.
Network interface we just discussed that are the interfaces on your computer.
Now, if you are running a physical server, you could see behind your physical server there are ports.
Those ports are used to connect the Internet, the Ethernet five cables.
Now those ports are connected onto a network card.
So once that card is installed on your computer, they give you the network interfaces.
So you do need a network interface in order to communicate to other computers.
Then we have Mac addresses.
Every time that network interface is gets installed, it has a hard coded MAC addresses that never changes.
Then you have a subnet mask.
Subnet mask actually allows your IP range to go either to a certain number of IPS or to an X or to an
additional number of IPS in your environment.
We'll cover it really quickly after that.
Then we'll talk about Gateway.
Gateway is most likely is an IP assigned to your router, which allows you to take your traffic from
your computer to outside to other computers.
Then DNS, which is domain name system.
It allows you to have IP to hostname, hostname to IP.
And.
Hostname to hostname, the bonding, the, the, the registration of your computer.
So back in the days, any computer that came on board, it has an IP address.
So it was so hard to remember the IP addresses for your computer.
So that's when the DNS came along and we started assigning IP addresses and to its hostname.
So it's easier to remember.
All right, let's look out.
Look at our Linux machine and we'll go through it one by one.
Again, I have my Linux Putty right here logged in already.
Let's clear the screen and let's move to the right first thing, first network interface.
How do we know?
How many network interfaces do we have?
Again, same command if config, it will give us the network interfaces right here in PS three.
Let me make this bigger.
So that's where you'll see everything on one screen.
NPM zero SE three.
Low as local and virtual bridge adapter.
The this you need to have the communication within your system so your system processes don't use other
interface to communicate with each other.
So this is the one that you need to communicate to the outside world.
And this, by the way, is a sign of a new create your machine, your physical machine for the first
time.
Or if you're creating your machine on a virtual network, this is the network adapter.
So if you go to for example, in my case, if I go to this virtual box manager and if I go to setting.
And right here in the setting you'll see network and this is adapter one enable it is Brigitte adapter
that's what this ENP is zero three for.
If you want another adapter, shut down the machine, go to adapter to click on Enable and you will
have another adapter.
Close it out.
Now let's go to Mac address if you type if config again and you want to know the MAC address of your
network interface, you will see right here, this is the IP address and this is the MAC address.
See right here is ether.
That's a mac address.
0800270f 8412.
That Mac address is the hard coded Mac address or an address off your interface that will never change.
Your IP could change if you assign the static one time.
You could assign a different static, the second time it could change.
But this never changes and it is assigned by the manufacturer.
When your computer first time built or when your Ethernet card is built.
Then let's talk about the subnet mask right here.
You see this net mask?
This is the subnet mask.
The subnet mask is the mask that actually allows or control your traffic.
If your if your traffic has to go to from one machine to another, it will find out whether it has to
go through a router or it has to go directly within a machine to another machine.
So that's what defines the subnet mask.
If you need to learn more about subnet mask, I recommend that you look it up online and you will find
a detailed information about subnet mask.
Then you have a gateway right here.
You don't see the information of the gateway.
So in order to get the gateway information, you will have to type net stat minus a sorry, not a net
stat minus rand v this command will give you your gateway information.
So right here says destination anywhere you want it to go outside of this computer.
You have to go through the Gateway 10 to 53, 1.1.
And by the way, this is the IP address of my router.
You probably have the IP address here of your router too.
And you probably most likely going to see is 121 68 1.1.
Okay.
Next one is the DNS DNS.
Allows you to create records between hostname to IP, IP to hostname and hostname to hostname if you
wanted to go and and go to your google.com.
So let's say a or to ping ping is the command I'll cover in a little bit if I wanted to go to Google
dot com, you'll see it goes to the DNS and ask Hayden's what is the IP address of Google.
And Google says here sorry hey DNS, what is the IP address of Google?
And then DNS would say here, this is the IP address of the Google.
Now.
How do I know?
Where is my DNS?
You will find out about your DNS by running the command and look up.
And then do w-w-what google.com and its tell you your DNS server is this 10 to 53, 1.1 and this is
the one who's answering you your queries.
And now you're probably thinking, Hey Imron, isn't that the same as the gateway?
Yes.
In the local environment.
In your home environment.
Most of the time, your server, your gateway or your router performs to function.
It performs DNS as well as the gateway.
Okay.
So let's.
We already looked at our machine.
Let's move on to the next topic and that is getting started with network manager.
Network manager is a service and a set of tools designed specifically to make it easier to manage the
network and configuration on Linux systems.
And it is the default network management service.
Unreal.
Eight.
It makes network management a lot easier.
It provides easy to set up of connection to the user.
Network manager offers management through tools such as GWI and MT, UI and MKL.
I will cover that later.
Let's practice in our Linux machine and see how we could access network manager go to our putty machine
again.
Let's clear the screen and you could run Simple Command System CTL Status Network Manager Make sure
you're using MN as a uppercase M uppercase hit enter and you will see that the the service is up and
running and the daemon is right here and you type queue to get out of it.
You can also do PS minus F grep for network and then you will see it will also give you the same information
that the process is running.
Now this is the service network manager which controls your entire network.
Every time you make changes to your network, you most likely would have to restart your network manager.
Okay.
Moving on to the next one, which is a network configuration and methods.
Now, this is where we're going to talk about the different commands that we have and we could use to
control or manage our network in Linux environment.
All right.
The first one is an MCI short for network manager.
Command line interface.
This tool is useful when access to a graphical environment is not available and can also be used within
scripts to make network configuration changes.
Then the next one an MTI short for network manager Tex user interface.
This tool can be run within any terminal window and allows changes to be made by making menu selection
and entering data.
Then we have an MX connection editor.
It's a full graphical management tool providing access to most of the network manager configuration
options.
It can only be accessed to the desktop or console.
Then we have genome setting.
You could go to the console on your genome desktop to access the settings.
All right.
Let's practice in our Linux environment real quick.
The first thing is Nemesis, Ally and MCI can be run on our terminal.
So let's clear the screen and you should run this command when you do not get a tex graphical user interface.
So now, Clive, and you run that you will get the information about your network adapters, other adapters.
If you wanted to get the exact adapters, you could do an MCI connection status and you will see.
Connection stat.
Most likely an M.S. ally lets type help.
And here you will see you could get help and get information about anything that you want to work on.
So I was working on an M.S. ally and right here says connection, right?
So let's type connection.
And it gave me the both connection and p0s3 and virtual adapter type, ethernet and type, which there
are many commands that you could use or many options, I would say that you could use within NM SLI
right here.
And if you wanted to write scripts, you could actually incorporate an MSI ally in your script.
Let's say if you wanted to configure a static IP using NM CLI, then you would have to use nm cli connection
and then you have to use a mod.
So let's say an MCI connection help you will see you'll get additional help after that.
So you have reload up, add, modify, see right here, modify.
Then you can modify followed by the network interface.
All right.
So let's go ahead and start using NM CLI to configure a static IP.
So the procedure that I have, it's listed right here and we will log into our Linux machine through
the console because as soon as we modify a network connection, we could lose a putty session.
So it's better that you log in through the console.
And of course, please make sure that you take a snapshot of your virtual machine if you're running
your Linux system on a virtual machine.
All right.
So I have my Linux virtual machine right here up and running.
And if I do, if config, you'll see right now I have an IP address of 10 to 53, 1.92.
I wanted to assign a static IP.
So static IP that I picked for this exercise is 10 to 53 1.2 11.
All right.
So let's go ahead and run the command and MCI device.
This will give us the listing of all the network devices that you get if config as well right here UNP
zero se three and l o as local.
Let's clear the screen.
You could also run the command like IP address or IP DDR, which will give you the same information
about your network interface.
All right, let's go ahead and run and MCI Command to modify our network connection or interface and
assign a static IP, the MCI connection.
Modify E and p03.
That's our interface and we are assigning IP to our IPv4 and we'll use addresses space, the IP address
that we are trying to assign.
10.2 50 3.1.2 11 slash.
24 subnet enter.
All right, now you have to assign the gateway.
So simply hit up arrow key to repeat the command and modify the part where it says addresses, change
it to Gateway.
And what is the Gateway?
10.2 53.11.
Perfect.
Now method will be Manuel.
You're assigning it manually right now.
Modify the DNS if you have to modify the DNS or if you already have a DNS, then you don't have to.
But for this exercise we will modify the DNS well and the DNS will be 8.8.8.8.
Or you could use the same gateway IP address as for DNS anyway.
Hit enter.
Now you need to reset your interface so you can use the command nmc ly connection down e and p zero
se three and you can see I'm using amp percent or and sine and then continuing the command so you could
use the entire command in one shot or you could use first down command and then up command.
So it's down.
It's successfully deactivated.
Now hit up our key and change down to up.
And right here is this connection successfully activated?
Excellent.
Now to verify, run the command IP address show in p zero.
SE three and right here you'll see the IP address has been assigned a 10.2 50 2.1.2 11.
Excellent.
So it worked.
Now what?
If you want to assign a second or secondary static IP to the same interface using an MCI utility?
All right.
Yes, you could do that without disturbing the existing IP address.
So here is the list of commands that will run.
Let's go back to our.
Console.
All right, now let's clear the screen.
Let's do an MCI device status just to make sure the status for this in PS or C three is connected.
All right.
We can also show the active ones and MCI Connection show.
Dash.
Dash active.
Actually, it is not dash.
It's double dash.
Just PowerPoint slide.
Change it to a solid hyphen.
But remember, it's dash.
Dash.
All right.
Anyway, it gives me the information about ENP zero SE three.
Beautiful.
Now, if config to see the IP assigned that current IP assigned to ENP zero S3 IPV four.
This is the IPV have assigned previously.
All right, now, are we going to assign a secondary IP?
All right.
For that and Macleay connection, modify ENP.
Zero three.
Plus, remember now we have to add the plus sign with IPV four dot addresses.
Now enter the new or secondary IP ten .0.0.2 11 slash 24.
All right.
Now do an Macleay connection.
Reload, which will do the same thing as if you would do an mhclg connection down MP zero SE three or
up MP zero three.
There you go.
Now you could reboot your system by doing the reboot command or system CTL command just to confirm that
you're setting say the same even after the reboot.
Now you could go ahead and reboot your system for these settings to take effect.
Okay.
Rebooting is going to take a little time.
I'm going to fast forward it.
All right, we got the system back online.
Now let's run IP.
Show.
IP address.
Show to confirm whether the second IP was added or not.
All right, here we have our end zero three interface.
The first IP that we assigned is 10 to 53, 1 to 11.
It is there.
Now, the secondary IP, as you see right here.
It is a sign as well.
That's beautiful.
All right.
So anyway, that's what we wanted to cover is to assign a static IP using NM CLI and assigning a secondary
static IP using NM SQL utility as well.
Okay.
So now let's look at the NMT UI utility which can be accessed through console as well as on the putty
session.
So let's go and access that.
So simply type NMT UI head enter.
See this is the the text interface which looks like a graphical, but it's not graphical.
It's a text based.
All right.
First thing we will do is please select an option.
The first option we have added an existing connection.
So hit enter and you will see you get the two connection.
ENP zero SE three and virtual bridge adapter if you want to work on the first adapter end zero SE three,
you moved your cursor to the right and click edit and the profile name the device Mac address right
here it says IPv4 configuration automatic.
If you wanted to assign a manual static IP, you have to hit enter.
And type and select a manual and then click show and you would have to add the IP address to whatever
the static IP address that you wanted to assign to.
So let's go back to manual.
Change it to automatic.
Hide it.
And the second one is IPV six configuration.
You can leave that out for now and you can click okay.
And it will take the configuration.
So for for us, we're going to just simply cancel it.
And by the way, if you are editing it without being rude, it will not give you the option to click.
Okay.
So you have to run this nm UI as a route user.
All right, let's cancel it one more time.
Let's go to this one, which is delete.
You don't want to delete this adapter.
So let's go down and click on back.
The next one is activate a connection.
So if you have a network adapter already, add it to your computer but it's not active.
Then you could go to this option and pick the one that you want to activate.
And let's say if this was not activated, you would have seen right here as an activate option.
Let's go back.
And let's do the set system hostname.
If you want to change your Linux machine hostname you can come here and change that hostname click cancel,
go to quit.
And let's say if you want to make any changes, of course, please make sure you become root.
And then type in MTI.
All right.
So let's say if I wanted to edit the connection, I wanted to go to edit.
And right here, let's say show.
And IP configuration automatic and you want to disable it.
Change it.
Make it manual.
And right here.
Now, when you enter it.
You will be able to add and click.
Okay.
Anyway, that was for being root and just go see.
Now you have the option to select.
Okay, now simply click cancel.
That's fine because we're not making any changes and simply click quit moving on to NM connection added
to this you cannot run from the command line.
You have to go to console.
Oops, let's go to console.
Castle is right here.
Hit, enter.
Go ahead, hit password and to password.
And now type in NM Dash Connection Editor.
Okay.
See, right here, you have that gooey geographical window.
Now, you could go in here.
Select the Ethernet adapter you wanted to pick.
Make any changes you want.
IPV four setting IPV come down to method.
Drop it and you could change manual to DHCP, whichever that you want to assign, add additional gateway
and so on.
Click Cancel.
Cancel.
If you have access to the console, then definitely use this name.
Connection Editor.
Then the last one is genome setting.
Genome setting, meaning you could go to activities and go to your show application and go to setting.
Right here.
You'll see.
I have connected on the network.
If you come down network and here you can make certain changes.
Click on this wheel and make changes to wherever that you want to make changes to.
But cancel.
Cancel.
And cancel.
And by the way, let me add something here.
If you are using an empty UI tool and you wanted to add a connection, once the connection is added
from your virtual box, then you could actually do NEC bonding or teaming through this same tool.
And it's a lot easier to do that.
See, right here it says ADD and you click on ADD and you come down, it says Bond or team.
This is this is where you could pick the option to bond to network interfaces together in case one network
interface dies, the other one picks up.
Okay.
Cancel it.
Come down, cancel it and quit.
All right, let's clear the screen.
Let's go back to our PowerPoint slide.
Let's go to the next screen.
And that is network files and basic commands.
The files that you should know as a Linux administrator to manage your network is at CSIS Config Network
Scripts.
Let's see.
Host That's your host names.
These are the files you need to know and these are the commands you should know.
Now let's look at these commands one by one.
And these while one by one, really quick.
The first file that you should know is at sea.
It's this config network script.
Now, if you are modifying your network manually by going into the files, which was the case in the
older versions of of Linux, now you have these fancy tools, you don't have to modify the files.
You could do it through the tools, but if you have to come to the files and modify it, you could come
to this directory to LHS minus TR and you will see this is the network interface you have to modify
in case you wanted to assign a static IP or make any changes.
If I do more if cfg, you'll see right here you see boot proto dhcp it shows that IP assignment to my
linux machine is done through DHCP, not through static.
If you want to change it to static, then replace the CCP with static.
All right.
Next file is at C.
So let's do cat at C host.
This is the file that is a local file to your machine to keep track of IP to hostname.
It's like a local DNS in your machine.
If you want to ping something, let's say your own hostname, you could see you could type ping local
host c this is the local host pinging.
Because it has the IP address to this one.
Now if I wanted to hang my hostname, let's say ping.
This is my host name.
Right.
It is pinging right here because this is the hostname assigned to my network interface.
You could also add this hostname to IP assignment into this etsy host file.
Let's clear the screen.
The next one is if you want to change the hostname of your computer, you could go to.
At sea, host names and modify your host name of your computer right here and then restart your network
manager.
Then you have another important file that you should look for is at Sea Resolve dot com file.
This is the file where you could actually keep the information of your DNS server.
Every time you have to go to another machine through the host name, your operating system is going
to come to this file, consult this file and ask this file.
Hey, who is my DNS?
This file is going to tell you operating system, your DNS or in other words, it's also referred to
as name server is right here, 10 to 53, 1.1.
Then another file that you should know is cat is at sea and switch.
This file is used if you want your system to go to first files or DNS first.
Right here it says I want.
Every time my operating system needs IP to hostname lookups, I want it to go to files first which is
at host if and then if the entry is not there, then I want it to go to DNS.
So that's why the same way, if I want my shadow or passwords to go to files first, then I'll put files
here.
If I wanted to go to single sign ons, then a second method would be the source.
All right.
Moving on.
Let's clear the screen.
Let's talk about a few commands that you should really know as a Linux system administrator.
And if you want to go for RedHat certifications, you need to know these commands first.
Command is ping.
Ping command is one of the basic and most popular command that you should know when you are troubleshooting
network issues.
So if you have a computer, a remote computer, and you are trying to access it and it's not accessible,
the very first thing you've got to do is ping it.
So ping let's say if I cannot get to my gateway, I want to see my my gateway is reachable.
I'll do 10 to 50 3.1.1 C when you get this response right here.
64, but from this it means the computer is there and it's responding to my request is basically saying,
hey, are you there?
And it comes back.
It says, Yes, I'm here.
Then we already covered if config and IP command, which will give you the IP address.
Then the next command is if up and down.
If you notice in t ui there is there was the option and tt ui there was this option to activate connection.
So if you have a deactivated network interface, you could do it from here.
Or you could run this command if up or down or do the same thing, then you have net stat which we covered
in that stat minus a, if you do it, it will tell you what is connected to your machine and what is
going outside of your machine.
The ports up and running.
Next one is Trace Root.
Trace Root tells you how your computer is going from one machine to another if you run it and it's telling
you right here, bash trace traceroute command not found.
There is no package installed.
So install package traceroute or provide your command.
You could go ahead and click.
Yes.
And it will download the package that has this command and then you can run trace route.
Let's do no for now.
Next command is TCP dump command, which is a very powerful command, which is basically tracing everything
that's coming into your computer and going outside of your computer.
But before you run TCP dump, you need to know your interface where you're running that TCP dump.
I know my interface, which is end zero three, so I'll do TCP dump minus I for interface, then ENP
zero three hit enter.
So you see right now all the traffic that going out of my computer, coming into my computer, you see
it like coming right in front of your eyes.
It's so much traffic you could grep or filter it based on your packet filtering or requirement controls.
See.
Then you have this lookup.
We already covered it and it's lookup if you want to know what is the IP address of of a hostname or
of a website or server, you could do NSA lookup w w w dot let's say hotmail dot com.
It will give you the IP address of Hotmail, which is right here.
204791 97 to 1 two.
Same thing.
You could use Digg command as well.
Which will give you the same information, but its output will look a little different.
Here is the IP address that you were looking for and the last one, that ETHE tool that you should know
if you wanted to know your Ethernet adapter at speed, if others up or not its link speed status, then
you could use EITH tool again.
You have to provide the Ethernet network interface in p03 and I'll give you a lot of information about
your interface.
Spend time or read through it.
Run these commands again and again.
And once you practice and become expert in these commands and these files remembering it, you will
know everything that you should know about managing Linux networking.