PDA

View Full Version : Is this possible with QT or CPP: Routing Encapsulation / IP Encapsulation?



janton
10th December 2012, 21:14
Dear QT Developers,

8493
*image from: http://www.linuxvirtualserver.org/VS-DRouting.html

In simple language:
I would like to make a program that redirects users to a EXTERNAL server, change the request slightly and most important encapsulate the IP from the user. Therefore the respondse from the external server will go straight to the user, else it has to go to my server again and so causing extra unneeded bandwith. These servers are not in the same network.

Is such thing possible?

wysota
10th December 2012, 21:43
"It depends". In user space, yes, in kernel space, that's rather outside of Qt's scope.

prof.ebral
10th December 2012, 22:36
...and most important encapsulate the IP from the user.

Curious, is there a reason for this part? A sniffer would be able to see the service's IP when it responds straight to the user.

edit: Sorry, may I don't understand what you mean by 'encapsulate'.

ChrisW67
10th December 2012, 23:57
The linked article is talking about the director machine kernel modifying MAC address in Ethernet frames and transmitting them on the LAN to the 'real' server. This is not something that Qt is built for.

AFAICT the returning packets, while emitted by the 'real' server will contain a source IP address of the director's public interface courtesy of a couple of interface and routing table tricks.

At a higher level you may be able to do something like onion routing and hidden services (lookup Tor) to make client and server unaware of each other. This would come with substantial overhead.

janton
11th December 2012, 00:53
Sorry perhaps my question wasn't that clear, so I took my pen and draw it (there is nothing better then a clear picture)
I get back on your questions soon, the problem is... perhaps i did not explain as well as i hoped. See image below:

The circle starts with the user that sends a request to the server etc.
8494

I don't want to make changes to the kernel, i want to write a linux program that redirects a users request to a external server that then send the responds back to the user.:confused:

wysota
11th December 2012, 00:59
So what you want to do is a sort of network proxy. Yes, it is possible to do it with Qt with the only exception that the new request will not carry the user IP. And I don't think any networking stack will allow a user application to forge a packet with a fake IP address. Which sums up to the fact, that the reply will go back to the proxy and then can be forwarded back to the client.

However the question that comes to my mind is why you want to do it using Qt, I don't see any benefits of that.