Establish a TCP connection and send a message.
Network
Scroll sideways to exploreOpen full diagram
1. Test the closed port
PC1
ping -n -c 3 -W 1 192.168.1.100
nc -v -N -w 3 192.168.1.100 5555The ping succeeds, but the TCP connection is refused.
2. Start the server and send a message
PC2
nc -l -k 5555 >> /tmp/lab-tcp.txt &
listener_pid=$!PC1
timeout 120 tcpdump -U --immediate-mode -i eth0 -w /tmp/lab-tcp.pcap "tcp port 5555" &
capture_pid=$!
sleep 1PC1
printf 'tcp-handshake-lab\n' | nc -N -w 5 192.168.1.100 55553. Check the handshake and data
PC1
sleep 2
kill -INT "$capture_pid"
wait "$capture_pid" || true
tcpdump -nn -e -r /tmp/lab-tcp.pcapFind SYN, SYN+ACK, ACK, followed by data packets.
PC2
cat /tmp/lab-tcp.txt
kill "$listener_pid"The file should contain tcp-handshake-lab.
Validation
Click "Check". Once all steps pass, click "End".