• Stars
    star
    148
  • Rank 242,409 (Top 5 %)
  • Language
    C
  • Created over 13 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A parallelizing combination of ping/traceroute
netselect 0.3
=============

This is netselect, an ultrafast intelligent parallelizing binary-search
implementation of "ping."

Now stop laughing and pay attention.

netselect determines several facts about all of the hosts given on the
command line, much faster you would if you manually tried to use ping and
traceroute.  For example, if I type:

	netselect -vv ftp.fceia.unr.edu.ar ftp.kulnet.kuleuven.ac.be \
			ftp.cdrom.com ftp.debian.org ftp.de.debian.org
			
It tells me this:

ftp.fceia.unr.edu.ar                  2792 ms  23 hops  100% ok ( 1/ 1) [ 9213]
ftp.kulnet.kuleuven.ac.be             9999 ms  30 hops    0% ok
ftp.cdrom.com                           94 ms   8 hops  100% ok (10/10) [  169]
ftp.debian.org                          46 ms  15 hops  100% ok (10/10) [  115]
ftp.de.debian.org                     9999 ms  30 hops    0% ok
  115 ftp.debian.org
  
For each host, it figures out the approximate ping time (though not as
accurately as "ping" does), the number of network "hops" to reach the
target, and the percentage of ping requests that got through successfully. 

The value in brackets is the "score" of each operational host based on these
values.  A lower score is better.  The last line shows the server with the
best score.  If we had not used '-vv' on the command line, only this last
line would have been printed.

Note that for ftp.kulnet.kuleuven.ac.be and ftp.de.debian.org in this case,
nothing got through at all.  That indicates that either the host doesn't
exist, or it is down.

For a bigger example, try netselect-apt to build your own sources.list for apt
with the (possibily) fastest debian mirror.


But Why?
========

Why do I want to know about my ping times to computers in Belgium?  Well,
the main reason for netselect -- and its name gives you a hint -- is to help
choose the "best" server for you from among a (possibly very large) list.

Starting with version 0.2, netselect can make these decisions for you using
its scoring mechanism.  If you want, however, you can still pass the raw
results and score the servers as you like.  Try this, for example:

	netselect -vv -s 0 $(cat <your_list_of_sites>)
	
The "-s 0" option disables printing of scores at the bottom of the list, and
"-vv" enables printing of the statistics.


How does it work?
=================

First:

 - decode each hostname into an IP address, and stores each IP address into
   a table.  In netselect 0.2, this code was rewritten to resolve hostnames
   much more quickly than before.
   
Now for all hosts at once:
   
 - start firing UDP packets with "random-guess" TTL values, much like
   traceroute does.  Actually, the code for this is derived from traceroute.
   
 - if an "ICMP TTL Expired" message comes back, then the TTL was too low:
   the host is farther away than that.  Increase TTL next time.  Otherwise,
   a "Port Unreachable" message comes back, meaning the TTL was large
   enough.  Try a smaller one.  We do this until we narrow down the TTL. 
   (This is where the "binary search" comes in.)
   
 - Meanwhile, collect timing statistics for all packets that reached the
   host.  Packets that don't come back are considered lost.

When all the hosts have had their TTL values narrowed down, and the "-t"
minimum tries have expired, we're done.  Close the sockets and dump
the statistics to stdout.



Command-line Options
====================

Not much right now.  

	-v	-- verbose mode.  Displays nameserver resolution messages to
		   stderr.  You probably want this so that you don't get
		   bored waiting for a hundred name resolutions to finish.
		   
	-vv	-- very verbose mode.  Displays nameserver resolution and
		   statistics (not just scores) to stderr and stdout.
		   
	-vvv	-- very very verbose mode.  Everything -vv prints, plus
		   print every packet received as it happens.  Good for
		   debugging or trying to figure out how it works.
	
	-vvvv   -- very very very verbose mode. Everything -vvv prints,
		   plus a trace of all packets sent.
		   
	-m #	-- maximum ttl.  Don't accept hosts with more hops than
		   this.
		   
	-t #	-- make sure at least 50% of the hosts get tested with this
		   many packets.  The more packets you use, the more
		   accurate the results... and the longer it takes to run.
		   The default is 10, which is usually okay.
	
	-s #	-- print this many "top-scoring" servers at the end of
		   the list.  "-s 0" disables printing of high scores.


The Future
==========


Here are some possible improvements:

	- try to estimate line bandwidth somehow.  The 'bing' program does
	  it using two different ping packet sizes.

	- try to improve 'ping time' estimate.  It's a problem right now
	  because netselect writes a lot of packets in a quick stream (for
	  speed reasons).  It's fair to each host, though:  they all put up
	  with an equal amount of lag :)

This program is highly experimental.  Please let me know what you think.

	- Avery Pennarun
	  <[email protected]>

More Repositories

1

sshuttle

Wrong project! You should head over to http://github.com/sshuttle/sshuttle
Python
8,904
star
2

redo

Smaller, easier, more powerful, and more reliable than make. An implementation of djb's redo.
Python
1,754
star
3

blip

A tool for seeing your Internet latency. Try it at http://gfblip.appspot.com/
JavaScript
1,597
star
4

git-subtree

An experimental alternative to the git-submodule command. Merges and splits subtrees from your project into subprojects and back.
Shell
1,359
star
5

git-subtrac

Keep the content for your git submodules all in one place: the parent repo.
Go
376
star
6

gitbuilder

Auto-builds and tests all the branches of your git projects, showing pass/fail results on a web page/RSS feed. Isolates failures to the first commit that caused the problem.
Perl
140
star
7

mkdocs-exclude

A mkdocs plugin that lets you exclude files or trees from your output.
Python
82
star
8

wvtest

The "as stupid as possible" cross-platform unit testing framework for C, C++, C#, python, and sh.
C++
51
star
9

xclipsync

Trivial tool for synchronizing the clipboard between two X11 sessions
Shell
43
star
10

py-remoteexec

Run server code on a remote host without installing anything on the server. (git import of danderson's hg repo)
Python
31
star
11

wvstreams

C++ networking library including UniConf and a convenient D-Bus API
C++
28
star
12

afterquery

The fun begins after the serious analysts have gone home.
JavaScript
25
star
13

wavedroplet

Experimental app for visualizing wifi packet captures
Python
24
star
14

cron2rss

Programs for watching cron job output via rss
24
star
15

schedulator

Bottom-up project scheduling system based on Joel's Painless Software Schedules
Python
19
star
16

flashlight-vnc

A VNC viewer for Adobe Flash - forked from the official non-git version.
ActionScript
17
star
17

fixconsole

A go module to attach the Windows console to stdin/stdout/stderr if needed.
Go
16
star
18

port

minicom is too complicated. This command talks to a serial port.
Python
15
star
19

beamlab

Experimental wifi signal simulation
JavaScript
13
star
20

ekb

The knowledgebase software used on eqldata.com
Python
13
star
21

csv2sqlite

Very fast C++ importer from csv files to sqlite3 databases
C++
13
star
22

simhousing

A surprisingly poor simulator of Silicon Valley housing prices.
Python
11
star
23

notionchanges

Wiki-style RecentChanges page for Notion.so databases.
Go
11
star
24

cotvnc

Chicken of the VNC and vnsea, imported from Sourceforge and Google Code
C
10
star
25

mobwrite

git import of the google-mobwrite project from Google Code
JavaScript
9
star
26

jfauth

Just Fast Authentication - an auth daemon with a PAM client that talks to it, and replication over SSL.
C++
8
star
27

crampi

Replicate contacts between fat_free_crm and MAPI (Outlook and Exchange), and maybe other things too.
Python
7
star
28

gracefultavi

A wiki optimized for internal collaboration (derived from WikiTikkiTavi)
PHP
5
star
29

ion1

Fork of ancient version 1.x of ion window manager
C
5
star
30

avebench

Ultra cheesy microbenchmarks
Python
5
star
31

wvbuild

Cross-platform build environment for WvStreams, including wvports
C++
4
star
32

versaplex

wvdotnet, wvdbus-sharp, schemamatic, and versaplexd source
C++
4
star
33

nitlog

A simple blog application in PHP using flat text files
PHP
4
star
34

builder-test

A stupid test project, suitable for testing gitbuilder
3
star
35

dropdyn

Experimental
C
1
star
36

wvdial

PPP dialer with built-in intelligence
C++
1
star
37

simswe

Python
1
star