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:
**Note**: Please wait an additional 2-3 minutes before connecting to the server via ssh.
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)
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.
On either box, run netstat to find out what ports have active connections and which are listening
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:
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
From the output, note your IPv4 address. This IP address should match that of the Private IP address provided above.