Utilizing Command Line Tools

30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

In this learning activity, the student will be provided two CentOS servers to practice the following command line tools, making note of the outputs received and how the commands are used:

* ping
* netstat
* nslookup/dig
* arp
* ifconfig

**Note**: Please wait an additional 2-3 minutes before connecting to the server via ssh.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Understand the Ping Command

Note: Please wait an additional 2-3 minutes before connecting to the server via ssh.

First, examine the man page for ping (this can be done on either Server1 or Client1)

man page ping

Secondly, from Server1 ping Client1 (Note the output)

ping 10.0.1.11

Lastly, play with some of the options of ping (-s to change packet size, -c to change number of packets, etc.). Note how the output changes with each of the options

ping -s [SizeOfPackets] 10.0.1.11
ping -c [CountOfPackets] 10.0.1.11
Understand the Netstat Command

First, review the man page on either Server1 or Client1:

man page netstat

On either server1 or Client1, you can run netstat –extended to see all available options.

netstat --extended

On either box, run netstat to find out what ports have active connections and which are listening

netstat

OR

netstat -a

Use the grep command in conjunction with netstat to learn more about particular ports, make sure to pick one that has an active connection and one that is listening to note the different outputs:

netstat | grep [portnumber]
Install bind-utils and Understand the nslookup and dig commands

To start off, we need to install bind-utils, as dig and nslookup do not ship with vanilla CentOS. This should be done on Server1 as some of the next steps will be taken on this box.

sudo yum install bind-utils

After installation, visit the nslookup and dig man pages to gather more information about these commands

man page dig
man page nslookup

Afterwards, from Server1 perform both an nslookup and dig on Client1, comparing the outputs. Notice how dig contains much more information that might be useful to an administrator:

nslookup 10.0.1.11
dig 10.0.1.11
Understand the arp command

Visit the arp man page to gain more knowledge about arp on either Server1 or Client1

 man page arp

From Server1, check what information exists about Client1 in the arp table. Note the output.

arp -a 10.0.1.11

Look at the entire arp table, noting output:

arp -a

Now, delete the record for Client1 (Only Client1) and check the arp table again. Notice that the entry is still there, but the hardware address is blank

sudo arp -d 10.0.1.11
arp -a

Ping Client1 to "rebuild" the entry, now check the arp entry for Client1 and notice that the hardware address has been re-entered.

ping 10.0.1.11
arp -a 10.0.1.11
Understand the ifconfig command

First off, open and review the man page for ifconfig on either device

man page ifconfig

On either system, run the ifconfig command, noting the output

ifconfig

From the output, note your IPv4 address. This IP address should match that of the Private IP address provided above.

Additional Resources

For the Security+ exam, it's going to be important to understand what commands to use under what circumstances and what their outputs may look like. Each task below is going to be examining certain commands on CentOS servers.

For each of them, ensure that you read the man page to get a better understanding of the commands and their possible options:

man page {command name}

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?