Skip to contentSkip to conversation

UDP routing issues with multiple NICs

LARTC Matthew Lowe 2 participants 3 messages Sep 9, 2004

lore
Share & tools
lore
#0 lore raw

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 / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 7 lines · Matthew Lowe

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.

You have to have a separate table for either nic. Adding one for nic2 isn't enough. Follow the instructions in the LARTC HOWTO.

Quoted 2 lines

Thanks,
Matt

Bye,

Peter Surda (Shurdeek) <[email protected]>, ICQ 10236103, +436505122023

Signature · 4 lines
Failure is not an option. It comes bundled with your Microsoft product.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Matthew Lowe

From what I understand of how routing works the table for the other interface is sort of redundant. If the gateway in the table for the first interface matches the gateway in the main table, then I don't see any point. None the less, I decided to humor the idea of creating another table for the first interface, and, as I suspected, it did not fix the problem.

To clarify, connections which properly bind to NIC2 will work. For example, apache, which is running on both NICs has no problem handling requests from either NIC.

The real issue is that the kernel is not recognizing that the UDP packet is part of a related series of packets coming in on NIC2. So instead it's choosing the ip associated with default route, which is IP1. Obviously this is the way it's suppose to work, since it's just following a simple routing table. I'm just looking for a workaround.

----- Original Message -----
From: Peter Surda <[email protected]>
Date: Thursday, September 9, 2004 3:55 am
Subject: Re: [LARTC] UDP routing issues with multiple NICs

Quoted 17 lines · Matthew Lowe
Quoted 1 line

Ok, the story is this, I'm running an Unreal Tournament 2004

server. It's

Quoted 1 line

running on a system that has two external NICs that are

connected to

Quoted 1 line

different ISPs. I would like players to be able to connect to

the server

Quoted 1 line

from either link. My default gateway goes through NIC1. For

traffic through

Quoted 1 line

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

Quoted 1 line

packets that have a source address that matches the IP of NIC2.

You have to have a separate table for either nic. Adding one for nic2 isn't
enough. Follow the instructions in the LARTC HOWTO.

Quoted 12 lines
Quoted 2 lines

Thanks,
Matt

Bye,

Peter Surda (Shurdeek) <[email protected]>, ICQ 10236103, +436505122023

Signature · 4 lines
Failure is not an option. It comes bundled with your Microsoft 
product._______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/