Juho Östman
Juho Östman

Reputation: 1594

Virtual TCP connections on Linux

There are various services listening on my host's IP interface, and I am writing a proxy running on the same system that should be able initiate TCP connections to them. It should be able to specify any source IP address for the connections. I could do this with a TUN device, but the actual connections originate from networks not based on TCP, so the proxy would have to implement TCP and segment the streams by itself, which is non-trivial. I would prefer to use the socket API and somehow spoof the source address and port. Is this possible in Linux, or is there another solution?

Upvotes: 2

Views: 404

Answers (1)

Juho Östman
Juho Östman

Reputation: 1594

I found the solution. IP_TRANSPARENT socket option should allow this.

Upvotes: 3

Related Questions