Elite and strict NAT

Community Support for the machines running the game
User avatar
thebs
Master
Master
Posts: 732
Joined: Sat Apr 16, 2016 6:49 pm
CMDR: thebs
CMDR_Platform: None Specified
Contact:

Loop ICMP ping (or traceroute UDP 53) every 15 seconds to different DNS servers

Postby thebs » Wed Jan 04, 2017 1:53 am

Roger Wilco Jr wrote:Offline Mode? Oh yeah - sorry.
I bet if thebs reads this, he will have a suggestion.

Indeed I do, and use something similar in hotel rooms. ;)

A) ICMP ping one time, with a 5 second timeout (or traceroute UDP port 53, with a TTL of 3), hitting ...
B) Various, public DNS servers (not just the same one), so the AP/Router thinks you're doing public DNS lookups on the Internet, and ...
C) Only do it every 15 seconds, so it doesn't look like a sustained ICMP flood that possibly gets filtered after awhile

Off Topic
More ideal would be to use traceroute UDP to port 53 (DNS) with a low TTL (even just 3 will usually suffice). But since Windows pathetic version of "tracetr" uses ICMP ping like, well ping itself, it's really no difference on Windows. Unless, of course, you install a full POSIX environment with it on Windows, like Red Hat's Cygwin.

Now if you're a DOS BAT or OS/2-NT CMD guru and can loop this, go for it. Even better if you know your Java/.NET System calls, so PowerShell is easy for you.

I'm a POSIX (UNIX/Linux) wennie, so I like Bourne-based shells (and Python). So on every Windows system, I install MSYS, (Minimal SYStem) from the MinGW project (long story), to get Bourne Again Shell (bash). Newer versions of Windows 10 will come with something similar with bash, so you might not need to install anything.

Basically just launch whatever gives you a bash shell (e.g., MSYS) and create a shell script in your home directory, aka folder, named something like "lp.sh" (for loop ping), like such. If you don't know where that is, launch your shell and run "touch ./lp.sh" and a blank file will be created. You should now be able to find it in Windows Explorer with something like Notepad++ (do not use regular notepad).

Code: Select all

#!/bin/bash
# lp.sh -- loop ping DNS servers to provide a poor man's keepalive
# space separated list of DNS servers
# e.g., AT&T, Google and ye'olde UUNET are good set of 6 in Norteamericana
MYDNS="4.2.2.1 4.2.2.2 8.8.4.4 8.8.8.8 198.6.1.2 198.6.1.3"
# number of seconds to wait in between
# use at least 15
MYSLEEP=15
# Loop forever (run in a MSYS window, minimize it, maximize again and hit Ctrl-C to exit)
while true ; do
  for s in $MYDNS ; do
    # windows ping options, 1 ping, 5000 (milliseconds = 5s) timeout
    # NOTE:  do *not* use for POSIX ping (which has completely different execution/options)
    ping -n 1 -w 5000 $s
    # More Ideal?  On POSIX, use traceroute udp to port 53 with a TTL of 3 instead of any ICMP
    sleep $MYSLEEP
  done
done

From now on you can bring up your shell and just run "sh ./lp.sh" (or set the execute bit so it's just "./lp.sh" -- but I'm trying not to overload people).
Image
CMDR TheBS - Yet Another Middle Aged American (YAMAA) and Extremely Casual Gamer often confused for a Total Noob

Spectre31
Harmless
Harmless
Posts: 17
Joined: Mon Jan 02, 2017 5:12 am
CMDR: Spectre31
CMDR_Platform: None Specified
Contact:

Re: Elite and strict NAT

Postby Spectre31 » Wed Jan 04, 2017 5:52 am

Okay thanks thebs, I literally had to read that twice to understand most of it so, please forgive my ignorance, just run bash and create a blank shell and insert code above with appropriate input? I'm no computer expert but I try lol

User avatar
thebs
Master
Master
Posts: 732
Joined: Sat Apr 16, 2016 6:49 pm
CMDR: thebs
CMDR_Platform: None Specified
Contact:

Re: Elite and strict NAT

Postby thebs » Thu Jan 05, 2017 3:18 am

Spectre31 wrote:Okay thanks thebs, I literally had to read that twice to understand most of it so, please forgive my ignorance, just run bash

Well, you'll need to install a bash shell. Only the latest Windows 10 builds offer one, and I don't think it's installed by default.

MSYS is a minimal installation option that works on any Windows release. Here's the direct download link: http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe

One of these days I'll make Java Swing (Graphical User Interface) program that runs on any OS and offers various 'keepalive' options. I've been meaning to find if anyone has already written similar.

Spectre31 wrote:and create a blank shell

A blank file in the shell. That way you can find where your "home directory" is inside of the MSYS bash shell.

You just run:

Code: Select all

touch ./lp.sh

And it creates a blank file. Then search in Windows explorer for "lp.sh" and it'll show you where that directory is.

Spectre31 wrote:and insert code above with appropriate input? I'm no computer expert but I try lol

I can e-mail you the script as a file already pre-made. That way you can just overwrite the empty file.

From then on, you just launch your bash shell (e.g., MSYS). And then run ...

Code: Select all

sh ./lp.sh

It will just keep looping through the DNS servers, trying to ping them every 15 seconds.
Image
CMDR TheBS - Yet Another Middle Aged American (YAMAA) and Extremely Casual Gamer often confused for a Total Noob


Return to “Hardware and Technical”

Who is online

Users browsing this forum: No registered users and 3 guests

i