Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-09-2014, 04:33 PM
|
#1
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Rep: 
|
Forwarding UDP Packets
Hi,
I've written a program in Python to act as a proxy to forward packets for a game. This involves both TCP connections and UDP messages. I had absolutely no problem with TCP, but I did run into issues with UDP.
I've used NAT with my router's Firewall and iptables on my Linux box to selectively forward packets. Here's what it looks like (IP Addresses changed)...
Router (Forwarding all TCP on port 443 to 443 on 192.168.1.99)
Router (Forwarding all UDP on port 53 to 443 on 192.168.1.99)
My Box (Forwarding UDP from IP 100.100.100.100 on port 443 to app 1 on my box or 192.168.1.99:10000)
My Box (Forwarding TCP from IP 100.100.100.100 on port 443 to app 1 on my box or 192.168.1.99:10000)
My Box (Forwarding UDP from IP 11.11.11.11 on port 443 to app 2 on my box or 192.168.1.99:11000)
My Box (Forwarding TCP from IP 11.11.11.11 on port 443 to app 2 on my box or 192.168.1.99:11000)
On my box, I see all incoming UDP packets (and can send them to/receive new packets from the server IP), but when I try to send the new packets back to my game client, it only sometimes gets through. When it doesn't work, I've used iptraf to look at my network traffic on my box (a Raspberry Pi) and I can see UDP packets received on port 443 from the external IPs, UDP packets sent to the server IP, UDP packets received from the server IP, and UDP packets sent to the game client (from port 443). On the computer running the game client, I only see the outgoing UDP packets though (using Wireshark).
I'm not really sure what's happening. On one of the game clients, it would normally work (and other times it won't work for like 10 minutes). On the other one, it doesn't ever seem to work. Do you think there's something wrong with this setup for some reason, or where should I look for problems at?
EDIT: Yeah just to double check, I ran the program in our local network with no forwarding or anything, and it works perfectly.
Last edited by Pluto is a Planet; 04-09-2014 at 10:45 PM.
|
|
|
04-12-2014, 09:49 PM
|
#2
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,430
|
Remember that the U in UDP = 'unreliable'; the IP layer is entitled to drop udp pkts if the n/w is getting loaded, which is why it (udp cxn) may come and go ...
|
|
|
04-12-2014, 11:55 PM
|
#3
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Original Poster
Rep: 
|
Well that's not actually what the U stands for but I guess I wasn't very clear in my post as to precisely what the problem is xD
What I'm saying is that I'm able to receive every packet from the client, send every packet to the server, receive every packet back, and every packet I send to the client isn't making it. As in there's a 0% success rate going in 1 of four directions. A total of 3 packets are sent, and the 4th never works.
...except for the first person I set this up for. It turns out the issue they were having was a software issue that I resolved, and now it always works for them. Even if they haven't been online for hours, I can't set this up for another person. I'm even trying to connect to this with our external IP and all the forwarding rules set up, and the same problem exists.
|
|
|
04-14-2014, 06:09 AM
|
#4
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,430
|
Tricky... you'll have to investigate the differences between the setups.
I don't know anything about games systems, but some of the guys do, so post much info as possible for them to help.
(Actually, I do know the the 'U' doesn't actually stand for that  but the practical effect is as if it were eg https://en.wikipedia.org/wiki/User_D...trol_solutions )
|
|
|
04-16-2014, 01:34 PM
|
#5
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Original Poster
Rep: 
|
Quote:
Originally Posted by chrism01
Tricky... you'll have to investigate the differences between the setups.
|
Yeah which is why I posted here, because there practically is none >.< I think I'm going to adjust my application to have one thread to listen to all UDP packets with one socket and send them to the appropriate thread to make everything happen on the same application. Each thread will then be responsible for using their own socket to forward and receive the data from the server, and using that one socket to send data back to the client.
|
|
|
All times are GMT -5. The time now is 06:49 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|