News: This forum is now permanently frozen.
Pages: [1]
Topic: Script works fine for a while then stops  (Read 2631 times)
« on: August 18, 2007, 05:42:30 »
SomaFM *
Posts: 20

Hello,

I have a script that I use often (will explain how it works in a second), and it worked fine for a while and then just stopped working one day. So I decided to use the latest beta version of m0n0wall, and right after doing so it worked fine again (had to re-do all my config settings). I am using the bootable CD by the way.

But today, just a day or so after going to the beta version, the script has stopped working again. The script (without getting into too much detail) is simply a php script that sends a UDP packet to a server, and the server will reply with a UDP packet of its own as a response. The script works perfectly fine on my webhost that is hosted by another company right now, so I know it's not the server on the other end or a problem with the script. It also works perfectly fine when I take m0n0wall out of the middle of my setup and connect directly to my cable modem. I also dont use any software firewalls that could be blocking traffic.

Looking into the m0n0wall logs in the Firewall States, I can see when I execute the script there is a total of 2 UDP packets (sent and received) with the IP that I'm working with. When I run it again, I see another instance of 2 packets now. And again, another instance. See my attached screenshot for this info. Anyways...that has to mean the data is coming back from the server right?... but I am never seeing it echo'd with my script.

So to continue my testing, I fired up Wireshark so I could do a packet scan on the machine running the script and see if the data was arriving. I thought that maybe the script just wasn't seeing the reply for some reason. So I run the script, and it shows the UDP packet being sent, but no response is ever received from the server. However, the count of packets in m0n0wall stays even meaning there had to be a reply. I also checked the firewall logs and saw no blocked packets from that IP address. I added a firewall rule to allow traffic from the server's IP just in case this was the issue, but still nothing.

It seems like the script is fine, since it works on my webhost and on my own machine when m0n0wall is not in use. It even worked when m0n0wall WAS in use, but it just randomly stopped working as I mentioned.

So yes, there's all my research I've done on this problem. Does anyone have any ideas why I am not getting the reply from the server, or what I could try to fix this problem? Sorry for the long post, but a run a support forum for my own website and I always appreciate when people provide lots of information about their setup.


* 1.JPG (42.87 KB, 595x346 - viewed 326 times.)
« Reply #1 on: August 19, 2007, 01:40:05 »
clarknova ***
Posts: 148

Looking into the m0n0wall logs in the Firewall States, I can see when I execute the script there is a total of 2 UDP packets (sent and received) ...that has to mean the data is coming back from the server right?...

No. All the packets in your screenshot are outgoing. Nothing came back through the firewall.

Quote
I added a firewall rule to allow traffic from the server's IP just in case this was the issue, but still nothing.

Did you create an incoming NAT rule forwarding UDP packets to the address of the pc running the script on your LAN? When doing so, check the box that automatically creates a firewall rule. Then, if desired, modify the source address of the resulting firewall rule (default is * or any) to exclude undesired addresses. Turn on logging for said rule, click apply on both NAT and firewall pages, run your script again, and check your firewall logs for passed packets. You may also turn on logging for the default block rule, a checkbox found on the Log->Settings page.

Quote
Sorry for the long post, but a run a support forum for my own website and I always appreciate when people provide lots of information about their setup.

The detail is indeed appreciated. Please report back with your results.

db
« Reply #2 on: August 19, 2007, 07:45:03 »
SomaFM *
Posts: 20

Thank you for the firewall suggestion, but I tried it and it didn't work, but the problem just got a little bit weirder and it may not be m0n0wall's fault. However I did end up fixing this whole deal (will explain in my huge post below), so no worries. And you might be able to explain the weird behavior I encountered while doing more testing getting it to work. Here is my story:

When m0n0wall is being used: The script sends the udp packet and it should get a reply from the same IP it just sent it to. However, taking a closer look at the firewall logs, no reply comes from the original IP I sent it to, but a reply DOES come back from a different IP (we'll called this IP2 for simplification because I'll be mentioning it a few times) belonging to this same company, with the source port 29910. I know this is the reply I'm looking for because IP2 is almost exactly the same as the original IP, and the port it's using is 29910. However since IP2 is different than the original IP I connected to, that is why the script may not be picking up the reply it sends.. because the socket was opened for the original IP and not IP2.

So I tried adding rules to accept udp packets from IP2 so they wouldn't be blocked. Still no go,...the script wouldn't pick up the reply, but the packets are being flagged as allowed now as I told it to.

So I unplugged m0n0wall and directly connected to my cable modem and ran the script again. It worked fine now Shocked. I fired up Wireshark to see what IP sent me the reply, and it was the original IP this time! And IP2, the one that sent the reply before when m0n0wall was in use... well it just didn't come in to play now. I didn't see it at all in Wireshark. No idea why it would send a reply from IP2 only when m0n0wall is being used, but not when it's just a direct connection to the cable modem.

I plugged m0n0wall back in, and adjusted the script to start the connection with IP2 instead, to see if it would work with the script. And it did, with m0n0wall in the middle too! And it still works to this second. So now I am initially connecting to IP2 and getting a reply from it, and the script works great with m0n0wall.

This is why I don't think it's m0n0wall's fault, because the server had to be the one deciding to have IP2 send a reply instead of the original IP. But I am still stumped as to why IP2 would send a reply when m0n0wall is in use, but not send anything when m0n0wall is NOT being used.

All in all, the script works great now that I am just working with just the "IP2" and I am satisfied. But the behavior of everything is just weird....unless I am not understanding something  Tongue.

Feel free to comment, I would love to have it explained. But if not, I will still be happy knowing that the script works once again. Thanks  Cool
« Reply #3 on: August 20, 2007, 22:04:54 »
clarknova ***
Posts: 148

Odd for sure. I can't explain that one. Glad you got it working though.

BTW, are you streaming for somafm.com? I love that site, particulary Groove Salad. And my toddler digs Tag's Smiley

db
« Reply #4 on: August 21, 2007, 07:10:41 »
SomaFM *
Posts: 20

Odd for sure. I can't explain that one. Glad you got it working though.

BTW, are you streaming for somafm.com? I love that site, particulary Groove Salad. And my toddler digs Tag's Smiley

db

Nope, just a fan who enjoys their stations. I use this name on most of the forums I visit. Groove Salad is my favorite station though, then maybe Space Station  Cool Cool

And thanks again for the suggestions!
 
Pages: [1]
 
 
Powered by SMF 1.1.20 | SMF © 2013, Simple Machines