LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-27-2007, 11:25 AM   #1
houkouonchi
LQ Newbie
 
Registered: Nov 2005
Location: Corona, CA
Posts: 12

Rep: Reputation: 0
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?
 
Old 11-28-2007, 04:52 AM   #2
houkouonchi
LQ Newbie
 
Registered: Nov 2005
Location: Corona, CA
Posts: 12

Original Poster
Rep: Reputation: 0
I tried several forwarding tools but none of them seemed to work until this one:

»tlswrap.sunsite.dk/lamefwd/

This one did exactly what I wanted and worked great. The only problem is that it can't bind to specific interfaces so it would listen on all the interfaces but this limitation was easy to get around as I am used to programs not having the ability to bind to an interface (I have multiple connections so I had to search away around this in the past) and used it in conjunction with:

»mega.ist.utl.pt/~luis/socketlock/

That way I could have the server on the same port as the original one. What is kind of funny though is just after getting this working my routing changed and now the latency is the same even to the new IP address I added. Oh well. The whole point of this originally was the new IP I added to I had a good 10ms lower than the other two IPs but now they are all the same. Atleast if routing changes again I can make use of this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Stop a UDP Packet Flood ! murder Linux - Newbie 2 09-19-2005 10:14 AM
setting packet forwarder b123coder Linux - Networking 1 05-05-2005 06:27 AM
UDP packet oss dazdaz Linux - Networking 2 04-05-2004 01:30 PM
game proxy ? udp forwarding ? tunnel ? n33dH3lp Linux - Networking 1 11-10-2003 12:13 PM
UDP: short packet markus1982 Linux - Security 4 08-12-2003 08:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration