UDP routing issues with multiple NICs

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, the story is this, I'm running an Unreal Tournament 2004 server. It's running on a system that has two external NICs that are connected to different ISPs. I would like players to be able to connect to the server from either link. My default gateway goes through NIC1. For traffic through NIC2 to work I simply added an extra routing table and rule. The extra routing table has the default gateway for NIC2 in it and is triggered by packets that have a source address that matches the IP of NIC2. 

The problem I have is this, the server will listen on port 7777 and bind itself to INADDR_ANY (0.0.0.0). When a client sends a request through NIC1, everything works perfectly. When a client sends a request through NIC2, the server gets the packet, but the return packet is sent out NIC1 (and should be sent out NIC2). Since the server uses the same socket to send packets as it does to receive packets the source address of each packet will be 0.0.0.0, meaning it's up to the kernel to determine the correct route and source IP address. This means that the kernel always fills in the IP address associated with the default gateway in the main routing table. The rule I used to route traffic through NIC2 will not catch the packets because the source address, at the time, is 0.0.0.0. 

If I force a specific IP to be routed through NIC2, then that IP can connect successfuly to the server over NIC2. 

I'm looking for possible solutions, but so far have only found one to have it later debunked. I have considered NAT, and determined that it won't work. I can't DNAT from IP2 to IP1, for reasons still not entirely known to me. For some reason DNAT from IP2 to IP1 doesn't get any sort of response from the server. Even after I have removed ALL firewall rules. I can however DNAT to the internal IP (which would be the 3rd NIC). Doing this doesn't fix the problem though, the server still sends the data out on NIC1 using IP1.

Any help is greatly appreciated.

Thanks,
Matt

_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux