Red Hat Enterprise Linux Diagnostics and Troubleshooting
Use some software tools to test network connectivity.
Outcomes
You should be able to use software tools to test network connectivity.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
[student@workstation ~]$ lab start network-testing
This command installs the required packages and enables the network ports through a firewall.
Instructions
Log in to
serveraand switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Test the network connectivity from the
serverasystem to theserverbsystem with thepingcommand.[root@servera ~]#
ping -c 2 serverb.lab.example.comPING serverb.lab.example.com (172.25.250.11) 56(84) bytes of data. 64 bytes from serverb.lab.example.com (172.25.250.11): icmp_seq=1 ttl=64 time=0.433 ms 64 bytes from serverb.lab.example.com (172.25.250.11): icmp_seq=2 ttl=64 time=0.457 ms --- serverb.lab.example.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1036ms rtt min/avg/max/mdev = 0.433/0.445/0.457/0.012 msUse the
nmapcommand to scan network ports.Install the
nmappackage if it is not already installed on theserverasystem.[root@servera ~]#
yum install nmap...output omitted... Complete!Scan the
172.25.250.0/24network to identify reachable systems in the network.[root@servera ~]#
nmap -sn 172.25.250.0/24Starting Nmap 7.70 ( https://nmap.org ) at 2021-10-25 10:14 EDT Nmap scan report for workstation.lab.example.com (172.25.250.9) Host is up (0.00078s latency). MAC Address: 52:54:00:00:FA:09 (QEMU virtual NIC) Nmap scan report for serverb.lab.example.com (172.25.250.11) Host is up (0.0022s latency). MAC Address: 52:54:00:00:FA:0B (QEMU virtual NIC) Nmap scan report for workstation.lab.example.com (172.25.250.254) Host is up (0.0010s latency). MAC Address: 52:54:00:00:FA:FE (QEMU virtual NIC) Nmap scan report for servera.lab.example.com (172.25.250.10) Host is up. Nmap done: 256 IP addresses (4 hosts up) scanned in 3.77 secondsScan for IPv4 ports on the
serverbsystem.[root@servera ~]#
nmap serverb.lab.example.comStarting Nmap 7.70 ( https://nmap.org ) at 2021-10-26 03:02 EDT Nmap scan report for serverb.lab.example.com (172.25.250.11) Host is up (0.00041s latency). Not shown: 996 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https 9090/tcp closed zeus-admin MAC Address: 52:54:00:00:FA:0B (QEMU virtual NIC) Nmap done: 1 IP address (1 host up) scanned in 16.12 seconds
Use the
ncatcommand to send content from theserverasystem to theserverbsystem.From the
workstationsystem, open another terminal, log in to theserverbsystem, and switch to therootuser.[student@workstation ~]$
ssh student@serverb...output omitted... [student@serverb ~]$sudo -i[sudo] password for student:student[root@serverb ~]#The start script of this exercise uses the
firewall-cmdcommand to open the4231/tcpnetwork port on theserverbsystem. Run thencatcommand on theserverbsystem to listen for packets from theserverasystem on port 4231.[root@serverb ~]#
ncat -l -k 4231Return to the
serverasystem. Use thenmapcommand to scan for ports on theserverbsystem.[root@servera ~]#
nmap -p4000-4999 serverbStarting Nmap 7.70 ( https://nmap.org ) at 2021-10-26 03:06 EDT Nmap scan report for serverb (172.25.250.11) Host is up (0.00050s latency). rDNS record for 172.25.250.11: serverb.lab.example.com Not shown: 999 filtered ports PORT STATE SERVICE 4231/tcp open vrml-multi-use MAC Address: 52:54:00:00:FA:0B (QEMU virtual NIC) Nmap done: 1 IP address (1 host up) scanned in 12.25 secondsFrom the
serverasystem, use thencatcommand to connect to port4231/tcpon theserverbsystem. Type a line of text, and then press Enter. Exit the prompt by typing Ctrl+C.[root@servera ~]#
ncat serverb 4231This is a testCtrl+CReturn to the
serverbsystem and verify that the text is displayed. Exit from thencatprompt by typing Ctrl+C.[root@serverb ~]#
ncat -l -k 4231This is a testCtrl+CClose the additional terminal, and return to
workstationas thestudentuser.[root@serverb ~]#
exit[student@serverb ~]$exit[student@workstation ~]$
On the
serverasystem, install theiptraf-ngpackage if it is not already installed.[root@servera ~]#
yum install iptraf-ng...output omitted... Complete!Start the
iptraf-ngapplication for network monitoring.[root@servera ~]#
iptraf-ngUse the arrow keys to navigate, and then press Enter to choose the highlighted menu item.
Select in the main menu. In the dialog, select for monitoring network traffic. The top frame shows all TCP connections. The bottom frame shows other types of packets.
Press X to return to the main menu in the
iptraf-ngcommand interface.Display network interface statistics with the
iptraf-ngcommand.Select , or press S to display interface statistics.
On the
workstationmachine, open another terminal, log in to theserverasystem, and switch to therootuser. Use the following command to generate some network traffic.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#ls -R /usr...output omitted...Watch the traffic counters change. The packet count starts increasing, and activity for
eth0rises.Press X and return to the main menu.
Create a filter to exclude SSH traffic, but monitor all other network traffic:
Select , and then select . In this screen, you can create and manage IP network filters.
Select and enter
Exclude SSHin the description box, and then press Enter. An empty list of filtering rules appears.Create a rule to exclude all incoming SSH traffic destined for port
22. Press A to add a new rule to the list of rules for this filter.Use Tab to navigate and enter
22in the first of the two fields of the column. In the field in the section, enter Y. In the field, enter E.Press Enter to accept the changes.
Create another rule to include all other network traffic. Press A to add another rule to the list of rules for this filter.
Enter Y in the protocol field in the section. Press Enter to accept the changes.
Press X to exit the rule definition screen.
To apply the created filter, select , and then select the filter.
Press X to exit the menu.
In the frame, confirms that the filter is in effect.
Press X to exit the menu.
To verify the newly created filter, select , and then select for the interface.
From the newly created SSH session to the
serveramachine, log out and log in to theserveramachine as therootuser.[root@servera ~]#
exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$ssh root@servera...output omitted... [root@servera ~]#Return to the terminal that is running the
iptraf-ngcommand and verify that the SSH in the TCP connection does not appear in the top frame. The counter at the bottom of the screen still increases.Return to the
serveramachine. Use thecurlcommand to connect toserverb.lab.example.com.[root@servera ~]#
curl serverb.lab.example.comWelcome to serverbReturn to the terminal that is running the
iptraf-ngcommand and check that a temporary connection172.25.250.11:80appears in the top frame. An HTTP connection uses a TCP connection. The HTTP connection is displayed because it did not match the first rule in the active filter.Close the
serveraterminal.[root@servera ~]#
exit[student@workstation ~]$exit
Return to the terminal where the
iptraf-ngtool is running. Press X to go to the main menu.In the
iptraf-ngwindow, detach and delete theExclude SSHfilter:Select and then select . Now select . A message appears with
IP filter deactivated.Press X to exit.
Select and select .
Press X twice and return to .
The changes to .
Press X and return to the main menu.
Select , and then select . Monitoring now shows the active SSH connections.
Press X and return to the main menu, and then press X again to exit the application.
Return to
workstationas thestudentuser.[root@servera ~]#
exit[student@servera ~]$exit[student@workstation ~]$