I have tried to measure packet loss on a data link with the Ipred tool through an SSH tunnel and it does not work. I can use TCP on the same SSH tunnel but then it's not possible to measure packet loss.
This will allow TCP connections on the port number 6667 of your local machine to be forwarded to the port number 6667 on server.foo.com through the secure channel.
Setup the TCP to UDP forward on the server
On the server, we open a listener on the TCP port 6667 which will forward data to UDP port 53 of a specified IP. If you want to do DNS forwarding like me, you can take the first nameserver's IP you will find in /etc/resolv.conf. But first, we need to create a fifo. The fifo is necessary to have two-way communications between the two channels. A simple shell pipe would only communicate left process' standard output to right process' standard input.
This will allow UDP traffic on local machine's port 53 to be forwarded to TCP traffic on local machine's port 6667.
Enjoy your local DNS server :)
As you've probably guessed it now, when a DNS query will be performed on the local machine, e.g. on local UDP port 53, it will be forwarded to local TCP port 6667, then to server's TCP port 6667, then to server's DNS server, UDP port 53 of 192.168.1.1. To enjoy DNS services on your local machine, put the following line as first nameserver in your /etc/resolv.conf:
Sorry, I have used the wrong approach. To tunnel UDP packets will probably solve the problem with the Firewall/NAT but it will not be possible to measure packet loss in a secure tunnel which use a reliable protocol like TCP.......... I will have to see what can be done with the Firewall/NAT or find an other tool than Iperf. Thanks for you help.