We're now on to taking a look at testing our network
access and network configuration issues.
I'm really hopeful that there's some very interesting things that
we're able to put across to you in this section.
Network access we can test very, very simply.
We know we've got the ping command.
We can also go through and access other utilities where perhaps ICMP
echos are not allowed and our ping is going to fail.
We could also take a look at misconfigured network configuration
where we might have an incorrect subnet mask,
meaning that we're unable to connect to all of the systems on our network.
Now one of the really nice things that we're able to show is an
understanding of our underlying command line.
Means that we can automate the ping of a default gateway.
Let's just take a look at this command we're pinging,
and then we've got an awful amount that follows,
but it's not so bad.
We're looking at our ip command and route show,
we're piping the output of that through to awk,
we're searching for default and printing the third field.
The third field is going to be the IP address of our default gateway.
So we could run this on any system,
and we're able then to ping our default gateway.
What a nice little hack this is.
We also don't need all of the octets in an IP version 4 address.
Well, what do I mean by that?
Well, we can ping 127.1.
We don't need to ping 127.0.0.1 because it's the middle octets are all zero,
they can be omitted.
Now whilst it's not very useful with a loop back address,
if we take a look at the Cloudflare DNS server,
which is 1.0.0.1,
1.1 really becomes a very practical way to check that we've
got communication to the outside world.
Checking our subnet mask might also be important.
We can see this with a simple ip and address show.
Looking for the subnet mask,
we want to make sure then that it is the same as
other hosts on the same network.
If it's not configured correctly,
we're not going to be able to communicate with all hosts on the network.
We can also go through and see it with the ip route command where we're
looking at showing the route table on our local system.
As I say, if ICMP has been disabled on our host,
then we might be able to discover if hosts are up by checking for open ports.
Here we're looking at how we could go through and
disable ICMP echos on our host.
It's a sysctl setting that we can configure.
We'll also see later there is a firewall setting that can also be configured.
Once we've made that setting,
we can read that setting in from the configuration file
to our running system using sysctl.
If we try and ping then our local host, we won't get a response,
but if we install nmap, we're going to be able to then go through and query,
and we know port 22 is going to be open,
so we can query for a response from port 22.
So really good,
especially where we know that our port should be open on that system
to see if we're getting a response from that port.
We can also go through and get a response from all of
our hosts from 11 through to 13.
On the 192.168.56 network, we should get a response.
So why don't we dive out to our command line and take a little bit of a look at how we put some of this into action?