UDP? NAT? But? But?
I was reading the FAQ, saying that UDP is somewhat better than TCP for network games. But one question did spring in my mind. With TCP, a router is able to forward the outbound stream to a server, and then know that every inbound TCP/IP packet on this port will be for the user that initiated the connection. This is why, for web browsing, we don't need special rules on the router. For an Natted server (using TCP) you must add a rule to the router (forwarding the port to the correct computer). Now, for UDP, this is a good question; does the router automatically know, when an outbound port on a computer is used (say: 1010) that is translated on the router to a port (next random port free, like 6553) that every incoming packet on this port should be rerouted to the correct port on the correct machine? I'm guessing that the answer is "NO" but I want to be sure. I've read elsewhere that CoH was using UDP for network transmission. But I didn't find any info that they needed special routers rules. How do they this? Do they use TCP for incoming data and UDP for outgoing?
When you initially connect to the server using UDP, the router adds a translation rule to it's table automatically. As long as data continues to flow between you and the server on those ports, that rule will remain in place. If you fail to send data after a period of time, then the rule will be removed.
Running a server of any kind (UDP or TCP) on a NATed network will require you to add rules to the router in order to forward to the appropriate target.
Running a server of any kind (UDP or TCP) on a NATed network will require you to add rules to the router in order to forward to the appropriate target.
In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
Quote:
Original post by Washu
When you initially connect to the server using UDP, the router adds a translation rule to it's table automatically. As long as data continues to flow between you and the server on those ports, that rule will remain in place. If you fail to send data after a period of time, then the rule will be removed.
Mmm I didn't know this.
So if my computer, behind a NAT start a communication on port 1000, the router translate it to 6000, every packet that the router receive on port 6000 will be automatically forwarded on port 1000 on my computer? This would solve nearly all of my problems.
You have to tell the router to forward a specific listening port on itself, to the machine that you are listening on.
Not quite.
If the computer inside the NAT sends a message from address SRCIP:SRCPORT to destination DSTIP:DSTPORT, and that gets translated to TXIP:TXPORT and sent to DSTIP:DSTPORT, then the rule is that any packet that comes back from DSTIP:DSTPORT, arriving at TXIP:TXPORT, gets translated back and forwarded to SRCIP:SRCPORT. Thus, a host other than the one you initially started talking to cannot use that same rule.
If the NAT has the rule that the same SRCIP:SRCPORT gets translated to the same TXIP:TXPORT no matter what the DSTIP:DSTPORT is, then the NAT is "NAT traversal friendly" and various introducer schemes can be made to work. There's more information about this in the Forum FAQ.
If the computer inside the NAT sends a message from address SRCIP:SRCPORT to destination DSTIP:DSTPORT, and that gets translated to TXIP:TXPORT and sent to DSTIP:DSTPORT, then the rule is that any packet that comes back from DSTIP:DSTPORT, arriving at TXIP:TXPORT, gets translated back and forwarded to SRCIP:SRCPORT. Thus, a host other than the one you initially started talking to cannot use that same rule.
If the NAT has the rule that the same SRCIP:SRCPORT gets translated to the same TXIP:TXPORT no matter what the DSTIP:DSTPORT is, then the NAT is "NAT traversal friendly" and various introducer schemes can be made to work. There's more information about this in the Forum FAQ.
enum Bool { True, False, FileNotFound };
Quote:
Original post by Dave
You have to tell the router to forward a specific listening port on itself, to the machine that you are listening on.
I was afraid of this. But I wondere how City Of Heroes did this. They seems to use UDP, and I didn't find any mention to some router configuration.
CoH works because you are connecting to their server. Thus the translation rule gets put into place automatically. Now days, almost all client routers will perform this automatically...can't think of one that won't at the moment.
In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
Okay, now I've got the picture. What I try to achieve will certainly not work, because, like hplus063 said, the rule is only set for one destination IP. And I'd like to do this for every IP, not only destination:
Phase A: the client connect to the server, putting the automatic rule on the router
Phase B: the client is working with the server. All is OK.
Phase C: the client receive messages from another client (perhaps NATed too) (direct chat feature). It will never receive them, because the rule only work for the server, unless the router is NAT traversal friendly.
NAT traversal friendly: is this frequent for the routers? I did search google, but I only found IETF pages dealing with it, i'm not sure that i'll find compatible routers.
edit:
I currently found a document here http://www.tml.tkk.fi/Publications/C/18/hu.pdf which explain some techniques to bypass this problem. The UDP punching hole technique seems to be promising, but I fail to understand some technical details...
[Edited by - PERECil on February 3, 2006 10:06:05 AM]
Phase A: the client connect to the server, putting the automatic rule on the router
Phase B: the client is working with the server. All is OK.
Phase C: the client receive messages from another client (perhaps NATed too) (direct chat feature). It will never receive them, because the rule only work for the server, unless the router is NAT traversal friendly.
NAT traversal friendly: is this frequent for the routers? I did search google, but I only found IETF pages dealing with it, i'm not sure that i'll find compatible routers.
edit:
I currently found a document here http://www.tml.tkk.fi/Publications/C/18/hu.pdf which explain some techniques to bypass this problem. The UDP punching hole technique seems to be promising, but I fail to understand some technical details...
[Edited by - PERECil on February 3, 2006 10:06:05 AM]
What you're talking about is known as NAT punch-through, or introduction, and is explicitly talked about in the Forum FAQ.
enum Bool { True, False, FileNotFound };
From the moment you expect a client to connect to another client, you have anyway to document it so that users can let it pass. Most firewalls will refuse a connection on the client, so NAT is only a secondary problem in that case!
I would recommend you to have a separated chat server to which all clients connect beside the main server. This solves your connection problems, your firewall problems, and probably some privacy problems too (I don't want any other user to know my IP).
I would recommend you to have a separated chat server to which all clients connect beside the main server. This solves your connection problems, your firewall problems, and probably some privacy problems too (I don't want any other user to know my IP).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement