Skip to content

Practice Exercise 1: netcat

Objectives

Set up a simple distributed system on instances to learn more about its components and principles.

Scenario

  • You have two instances serving as client (web1) and server (db1) respectively.
  • <name>-a1t-inf-ds-web1.acad.opswerks.net
  • <name>-a1t-inf-ds-db1.acad.opswerks.net

Tasks

  • SSH into the db1 instance and enter the command below:

    nc -l -p 12345 > file_received
    
    The flags -l is listen mode and -p indicates the port netcat will listen on, then pipe what is received through netcat to a file named file_received

  • SSH into the web1 instance and enter the commands below:

    echo "Mekus mekus, tornado" > file_to_send
    nc <name>-a1t-inf-ds-db1.acad.opswerks.net 12345 < file_to_send
    
    The first command creates a file named file_to_send and then sends the file using netcat to the hostname indicated.

Conclusion

This practice exercise helps you understand and differentiate between TCP and UDP and how they are used in implementation of different systems