Search code examples
c++linuxtcp

Force tcp/ip trace-route go through certain hop using C/C++ in Linux


I want some of the packets to go through certain hop(server) intead regular trace route that is determined by ISP how do I implement this should I use bind() when I sending the packet that I want to go through this hop

enter image description here


Solution

  • It is not possible to do this in general with direct TCP connections. The only exception would be if you controlled the network and you had two network interfaces routing outwards on completely different routes, but this is not possible in your case because the ISP controls its part of the network.

    The best way is to set up and use a proxy server on server HOP, then you can guarantee that all the selected packets will go through the proxy server.