UDP tunnel/packet forwarder
Anyone know a good way to do a UDP tunnel? Maybe through IPtables?
Basically here is the situation:
I have a box that has two NICs on it and it used to have two IP addresses (the IPs have been changed). Lets say they were:
eth0 1.1.1.20
eth1 1.1.2.20
This worked out good for me but a routing change happened and now I do not get so good latency to either IPs and 1.1.2.20 I run several game-servers off of. Now here is the issue, I don't really want to change the IP address of the gameservers but I found another IP I can use, lets call this one 2.1.1.20. I get quite a bit better of a ping to this IP so I changed my configu. it is now:
eth0 1.1.1.20
eth1 2.1.1.20
eth1:0 1.1.2.20
So Basically my gameservers are still accessible by the IP they always have been but I (only for my own use) would like to connect ot them using the 2.1.1.20 IP as I ping better to that IP. Well the problem is that the gameserver software only listens on the 1.1.2.20 IP and not the 2.1.1.20 IP and if I don't specify the IP when starting the game-server then it listens on all IPs but the problem is that the IP that is sent to the master server will be 1.1.1.20 which is really bad because I do a lot of traffic on eth0 and I don't want my gameserver to be effected by the traffic. I have the box setup so that all traffic always goes out of eth0 unless the program itself binds itself to eth1's IP.
Anyway here is what I thought as a solution was. Setup a UDP tunnel on 2.1.1.20 which forwards to 1.1.2.20 so I can connect using 2.1.1.20 giving me the lower latency I desire without having to actually change the servers IP itself. The problem is how do I do this... I have seen several programs that tunnel UDP over TCP and stuff like that but I don't need anything like that I just need a really simple tunnel which listens on 2.1.1.20 on a specific port (UDP) and forwards traffic to 1.1.2.20 (same port UDP). I think this might be achievable using iptables but I am not sure how.
Any suggestions?
|