[No audio]
IP Address Assigned but not reachable.
Okay, so I'm sure some of you probably have experienced
the issue where you do see the IP address but
you cannot connect to the machine through SSH or
from another machine, of course using SSH.
So that's where we are going to focus.
And this lecture is about troubleshooting issues that focuses on
how and what could be the reason the machine has
an IP address, but we still cannot connect or still
cannot go outside of that machine to other machines.
So the troubleshooting steps that we could go over
is the first one is we'll check if you
are on the correct network, by running ifconfig.
What does it mean? If you have multiple interfaces,
so let's say if your machine has three
interfaces instead of one, then you need to
make sure you are picking the right interface
where you have assigned the IP address.
Because the network team, now I'm talking about Virtualization
team or the network team, what they do is
if there are cables connected in the back of
a computer, then they will give an IP address
to one cable and not the other two.
So make sure the cable that is connected
to the correct interface is the interface is
actually being configured for that IP address.
So we'll take a look at that in a
little bit when we log into a Linux machine.
Also check to see if you got
the right subnet mask and gateway.
You always get the subnet information and
gateway information from your network engineer.
So make sure when you are talking to
your network engineer, make sure they have given
you the correct subnet and correct gateway.
There might be a typo, there might be a
fat finger when they sent you an email.
Instead of like 192.168.1.1 gateway, they probably give
it 2, and then you are just trying and figuring
out so hard, but it's just not working.
Then ping the gateway.
If you are on the right gateway, then
simply ping that gateway just to make sure
if you could reach that gateway.
If you cannot reach the gateway, then of course there's
something wrong with the gateway or something wrong with the
routing, which we'll take a look in a bit.
Check if the gateway is assigned.
So if your configuration is correct, then
the gateway will be assigned itself.
But if it is incorrect, then most likely you will
have a problem where the gateway will not show up.
So a gateway is like a gate which actually transport
all your traffic from your machine to another machine.
So if the gateway is not set in the
routing table, then you're going to have a problem.
Check with the network team if the correct vLAN is
assigned on the switch side. What does it mean?
It means that every network
IP addresses are different, right?
So the IP address that is given to you
is actually assigned to the correct IP range, which
is referred to as vLAN on the switching side,
if that is assigned to the correct vLAN.
If you have given an IP address, for example, 192.168.1.12,
and that in the back, on the switch side,
it is configured for IP address 10.172.16.1,
then no matter how many times
you try, it will not work.
Your computer will be okay, your setting
on your computer will be okay, but
the network switch side is not okay.
So make sure when you talk to your networking folks,
tell them that you are using this IP address.
Please make sure it is actually associated to
the correct vLAN on the switch side.
Run tools like ethtool or mii-tool to check the NIC status.
So of course, if you are not at
the data center, you cannot really physically verify
if the cable is connected right.
You cannot see the blinking light on the port.
So there are tools that could tell you if the
link status is up or down and those tools are
ethtool or mii-tool, which we'll check it in a little bit.
Also run the command ifup space the
interface command to bring up the NIC port.
Or you could just do ifdown and
then ifup just to reset the interface.
Maybe it was not set up correctly and
you probably have to restart. Restart network system
of course, which will do everything for you.
If things are not working, something is wrong,
if you're doing a systemctl restart network, and
there is something wrong with the network setting, it
will tell you where exactly the problem is.
Check on the status of NIC by
running ifconfig or ip addr command.
We know that we ran that command many times, but
on the NIC itself, you probably see the IP address,
you probably see it is assigned and NIC is up,
but the actual interface, NIC, is probably
not showing up as UP, meaning up.
So we'll check that in a little bit.
Also check to see if the IP
is assigned to some other device. Okay.
Yeah, that happens to me too.
In the past, if you are trying to assign an
IP, especially static IP, to your machine and everything looks
good but still having a problem, then there could be
a possibility that the IP that is given to you
has already been assigned to another machine.
People make mistakes.
That's why maybe the engineer, the network engineer has given
you that IP, which is a duplicate IP
and it's going to cause IP conflict.
So what will happen is, you will try to bring
your IP address up and it will come up, but
it won't work because it's already up by another computer.
Your IP address will only work
when the other computer shuts down.
So again, make sure there's no IP conflict.
And sometimes there are firewalls rules in place at the
operating system level or at the network switch level
which will prevent you to ping or SSH from one
machine to another. So make sure your firewall is turned
off at the OS level as well as the firewall
configuration is done right at the networking level. So again
bring it up with the networking team, ask them if
there are any issues with the firewall that has been
sitting in the middle of one computer which you're working
to another computer where you're trying to reach to.
So here are a few troubleshooting steps, let's go
into our Linux machine and we will actually
[No audio]
go through all these items.
[No audio]
Okay. This is my Linux machine.
I have it up and running, and I am logged in
as root. So now let's see, first check if you are
on the correct network interface. So if I do ifconfig
or if I do ip addr, address, you'll see
all the interfaces that you have available. Right now you see
you have enp0s3, lo, which is the loop back. This
is something you don't have to worry about.
You could ignore it and the same way you don't have
to worry about the virtual bridge adapter. If you had enp0s3 here,
and you had another one enp0s4,
s5, three of them, then you are trying to probably
assign this IP 192.168.1.36 or 37 whatever the IP is given
to you, you're probably assigning to s3. Well,
in fact it should go to enp0s4.
If that's the case, make sure you are assigning
it to the correct one. How do you know
you're assigning it to the correct one?
Well, the tools that you can use to check the status
if the Link status is up or not is by running
the ethtool or mii-tool. So if I have two
interfaces I could do ethtools enp0s3. When I hit Enter,
you'll see right here tells me the speed of this interface,
and somewhere here it will tell you something about Link, yes.
All the way at the bottom, you see it says Link
detected, it says yes. It means the cable in the back
is connected. Of course we are using virtualization Linux machine but
it will still read it as if the cable is connected
so you see right here it says Link detected: yes, perfect.
If you had enp0s4, or s5, and you had linked
it coming up as no then you know right away
okay, this IP address is not set up for that
interface, so you will assign it to the correct one.
Now the question is, what if you have three interfaces,
and all of them show up as link detected?
Yes then basically you have to go through the round robin
thing, you have to assign the IP to the first interface,
then the second, and then the third, and then see if
it works or not. Otherwise if you want to find out
the easier way, you have to talk to your networking guy
to find out which cable or which port has which vLAN.
I'm sure every company would have
a specific way of doing things.
Sometimes companies that I've work is
very good in the documentation.
They actually have spreadsheet which would tell which port on
the switch on the network switch goes to which port
on the server, because a server could have multiple ports,
so it will tell you exactly where it's going.
Also, if your networking team is not the ones
that doing all this work of running cables, then
you probably have an install team or data center
team that will perform all these tasks for you.
They are the one who will have that spreadsheet or
the information that would tell you exactly which cable is
going to which port and which port, or which cable
has which vLAN assigned. So check with them.
Then check to see if you got
the right subnet mask or gateway.
So even if you do ifconfig, you'll notice that your subnet mask
for this interface, net mask is 255.255.255.0.
Okay, you're looking at it and you're
like, okay, I have the gate.
There's something that masked.
Then why I cannot connect to this IP address?
Or why cannot I go from
this machine to another machine?
Probably your subnet mask that is
given to you is incorrect.
Maybe it's 255.255.254, 253, depending on
how your network is configured.
So again, confirm with your networking team
that you got the correct subnet mask.
Now, please remember this whole scenario.
I'm talking about the static IP assignment.
If you are on the DHCP IP assignment, which
is not static, then your computer, your operating system,
will pick up the correct net mask itself.
You don't have to worry about it.
Also it will pick up the gateway itself.
But in the static world, you do have
to specify the net mask and the gateway.
So, as I said, make sure you are
given the correct net mask and correct gateway.
Now, how do you check the gateway?
The command that I use to check
the gateway is netstat -rnv.
This will tell me right here, the first line.
First of all, right up here it's telling
you, these are the labels or the columns.
Then right here, the first column is telling
you all the traffic which is coming from
whichever the IP in this machine.
That's why it's given 0.0.0.0.
All that traffic should go to the gateway
192.168.1.1, and that gateway is telling it,
and all that traffic should be
routed through the interface enp0s3.
That's how you see it.
And then you'll see right here, all the
traffic of 192.168.1.0, should go to this gateway,
which is eventually were routed to this gateway.
And then it should have a subnet mask of 255.255.255.0.
The last one, you could ignore it, because as I
said, this is for the bridge, virtual bridge adapter.
You could even disable that adapter if you want.
But anyway, let's not get into this one.
I don't want to confuse you. All right.
So make sure the subnet masking gateway is correct.
Then next thing is, if you think it
is correct and it's given to you, by the
network folks the right gateway then ping it.
So ping 192.168.1.1. If you are getting a response
back which is say 64 bytes, and you are getting
the ICMP response back, it means the gateway is listening,
and it is responding, and it is up. This gateway,
in the real corporate world, this is the IP assigned,
most likely assigned it to the networking switch where all
the computers are connected.
So you pinged it, it works.
Check if the gateway is assigned.
I just covered that by running
the command netstat -rnv.
If you do not see that gateway that
is given to you assigned here then you
probably have incorrect configuration in your configuration file.
And where is that configuration file?
It's an /etc/sysconfig/network-scripts, and if you do
ifcfg-enp0s3, you'll see this is the
static configuration file setting and this will tell you right
here how the configuration should be set up and it
should have a gateway in here as well.
Right now you don't see it because
the type is set up for DHCP.
That is why you don't see it.
If you want to have a static, you
will have to add that gateway in there.
Next one is, check with the network team
if the correct vLAN is assigned on the switch, there isn't
any commands that you would have to run for that.
You would basically have to pick up a phone
or send an email to your network engineer and
ask them that you are on the correct vLAN.
Then check their tool ethtool or mii-tool.
I already covered that.
But to just go quickly run ethtool enp0s3
on your interface to check the status of your interface
if you want to know the speed of that port,
if you want to know whether it's full duplex, half
duplex, the link status you will run that command.
The other command is mii-tool enps03, and
you will see enp, did I type it correctly?
[No audio]
enp, oh no, interface is correct, enp0s3.
Now you'll see here it says no
no autonegotiation, thousand which is one gig of
interface, flow-control, and link is okay.
This is the same link okay as if you see here.
Is link detected? Yes.
And the last one if you are still trying everything,
you can always try to reboot your machine or you
could just simply do systemctl or system control restart
network and this will again go back to your configuration
file, find out if there are any issues.
If there are, it will notify you. Check on the
status of the NIC by running ifconfig command.
We have covered that. Also we could check if it is up
and down by looking at one specific thing that I was going
to show you is, right here it says enp0s3.
And you see right here it says up.
If it is not up, sometimes what happens is
you probably do see that the IP assigned and
everything is working and something that mask is correct.
But you don't see this little thing says UP right here.
So in order for you to bring this up, then
you could run the command ifconfig enp0s3 up,
and then when you run ifconfig
again, then you will see actually this will come up
as UP, and it will also second thing you have
to check is it's RUNNING, right here,
it's RUNNING. And if you see here, it
says UP BROADCAST, but it is not running.
So make sure it is running and then check to
see if the IP is assigned to some other devices.
And the only way you could do that is if
you go to another machine and ping that IP address
that you're trying to assign, see if it exists.
But if it is pingable, then try to
log into it and see if you're getting
landing into the right machine or not.
And the last one I said turn off the Firewall.
This is one of the things that you
could rule out by doing systemctl stop,
in the newer version is firewalld.
In the older version, it's a service iptable stop.
And it is telling you, since this is
a newer version of operating system, it's saying
I'm redirecting you to systemctl, and in there
you should use this stop iptable service.
So if I use that, I'm sure it
still exists, but it is deprecated not loaded.
Meaning it is there, but it is not loaded.
Failed to stop because it's not up and running. Why?
Because we have actually started running Firewalld
now. It's a newer version that runs on in
your CentOS or Redhat operating system.
So these are the pretty much the steps that
you need to take in the corporate environment.
And I am very sure, very hopeful if you go
through all these steps of troubleshooting, the IP address when
it is actually shows up, that it is up and
running, but somehow you cannot reach it.
That's why probably one of the reasons, I'm sure when
you go through it, you'll find it right there.
Yes, that was one of the reasons.
And again, if you're still having an
issue, I'm was here to help.
I'm always here to add more content
to newer things that come in.
[No audio]