Network Monitoring  «Prev 

Determining Network Connections - Exercise

Using netstat to view active TCP connections (Linux)

Objective: Use netstat to view active TCP connections.

Exercise Simulation

This exercise uses simulates a UNIX command line and allows you to practice entering commands.

Exercise scoring

This exercise is not scored. When you have completed the exercise, click the Submit button to continue with the course.

Instructions

In this exercise, you will use netstat to view active TCP connections on your machine. Start the simulation below and work through the situation presented. When you have completed the exercise, click the Submit button to review the exercise solution.

Netstat Linux 1
1) Netstat Linux 1

Netstat Linux 2
2) Netstat Linux 2

Netstat Linux 3
3) Netstat Linux 3

Netstat Linux 4
4) Netstat Linux 4

Netstat Linux 5
5) Netstat Linux 5

Netstat Linux 6
6) Netstat Linux 6

Netstat Linux 7
7) Netstat Linux 7

Netstat Linux 8
8) Netstat Linux 8

  1. You want to list the active TCP connections between your system and others. Issue the appropriate command now.
  2. List active TCP connections
  3. netstat -t
  4. Use netstat -t to discover the active TCP connections between your system and any other.
  1. Notice that you see only one connection. In the meantime, several users have opened Telnet connections on your system. Re-issue the netstat command to see what additional TCP connections have occurred.
  2. Re-issue netstat command
  3. netstat -t
  4. Use netstat -t to see what new connections have occurred.
  1. Notice that each connection comes from a different host. Each hostname has a colon after it, complete with a number. For example, othermachine has 13255 after it. The figure 13255 is the ephemeral, or temporary, TCP port number on the remote side of this new connection. Now, establish a Telnet connection to the remote host telnetserver.away.com, making sure that this process runs in the background. |||(S5)Hint: What character do you use to send a process to the background?
  2. Establish a Telnet connection
  3. telnet telnetserver.away.com
  4. Use telnet telnetserver.away.com & to connect to telnetserver.away.com.You need not specify a port number, because using Telnet defaults to port 23. Also, remember that the & sign makes the process run in the background.
  1. Reissue the netstat -t command to learn more about this connection.
  2. Re-issue netstat -t command,
  3. netstat -t
  4. Use netstat -t
  1. The readout shows that your Telnet client is connected to the Telnet port on the remote machine telnetserver.away.com. Now kill the background telnet process using kill %telnet
  2. Kill background telnet process,
  3. kill %telnet
  4. Enter kill %telnet to kill the background telnet process.