TCP packet transfer when sender and receiver are same system

Viewed 18

I am running server and client in same system. TCP protocol is used for communication between them. In a scenario where client wants to send packet to server, will it go through network infra (i.e. router, internet etc) and come to server or will it manage transfer within system and ignore network.

1 Answers

If you are on the server, any communication you initiate to IP addresses also on the same server will never leave the server.

You can test by installing tcpdump then running from the console/keyboard/mouse: tcpdump -n -i enp0s5 not arp

Do not generate network traffic. Try to ssh to your account on IP 127.0.0.1 (e.g. risner@127.0.0.1). Also try to initiate ssh to another host on the network.

Nothing should show on tcpdump, so that indicates it is not leaving the machine.

Related