File: README

package info (click to toggle)
guessnet 0.14-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 572 kB
  • ctags: 54
  • sloc: ansic: 463; sh: 330; perl: 118; makefile: 48
file content (125 lines) | stat: -rw-r--r-- 4,615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
README for guessnet 0.9 - Enrico Zini <zinie@cs.unibo.it>

Guessnet is a program to guess the current network location using fake ARP
packets.

Usage: guessnet [options] [ethernet device] [config_file]
  -d, --default=STRING     profile name to report if no known networks are
                           found (defaults to <interface>-none)
  -t, --timeout=INT        timeout (in seconds) used to wait for response
                           packets (defaults to 5 seconds)
  --init-time=INT          time (in seconds) to wait for the interface to
                           initialize when not found already up (defaults to 3
                           seconds)
  -v, --verbose            enable verbose operations
  -V, --very-verbose       enable debugging output
  --version                print version and exit

Help options:
  -?, --help               Show this help message
  --usage                  Display brief usage message

The program expects a list of network data, that can be read from a file or
from standard input.  The network data looks like this:

--------------------------------------------------------------------------
# Home network
192.168.1.2 00:01:02:03:04:05 192.168.1.1 home

# University
130.136.3.42 05:06:03:02:01:0A 130.136.1.1 university
130.136.3.42 15:13:B3:A2:2F:CD 130.136.1.2 university

# Work
10.1.1.42 0A:0B:0C:0D:0E:0F 10.1.1.1 work
10.1.1.42 0F:0E:0D:0C:0B:0A 10.1.1.2 work
--------------------------------------------------------------------------

Empty lines and comment lines starting with '#' are ignored.

A network data line identifies a candidate network to test and contains 4
fields:
 1) Local IP
      Indicates the IP to use as a source IP address for ARP requests.  At the
      moment I lack documentation about the ARP protocol, but I would like to
      remove the need to specify this field.  It should, however, be a valid
      (and probably unused) IP address inside the network we are testing.
 2) Remote MAC
      Indicates a MAC address for a host we know is present in this network.
      You can find macaddresses of other computers in the network using the
      command 'arp -v'; see man arp(8) for more details.
 3) Remote IP
      Indicates the IP address corresponding to the MAC address given.
 4) Network name
      Name to be printed on standard output if this network is found.

If no suitable network is found, a default name is printed.  The default name
can be changed with the -d or --default commandline option.

The program decides that no networks are found after some seconds passed
without receiving suitable ARP replies.  The timeout can be changed with the -t
or --timeout commandline option.

guessnet gets interesting if combined with the standard debian ifupdown
scripts, to automatically guess what data to use to configure the interface.

Here is an example /etc/network/interfaces file using guessnet:

--------------------------------------------------------------------------
auto lo eth0

iface lo inet loopback

mapping eth0
	# I'd really like if we could pass options to the script here!
	script /usr/bin/guessnet
	# Home network
	map 192.168.1.2 00:01:02:03:04:05 192.168.1.1 eth0-home
	# University
	map 130.136.3.42 05:06:03:02:01:0A 130.136.1.1 eth0-university
	map 130.136.3.42 15:13:B3:A2:2F:CD 130.136.1.2 eth0-university
	# Work
	map 10.1.1.42 0A:0B:0C:0D:0E:0F 10.1.1.1 eth0-work
	map 10.1.1.42 0F:0E:0D:0C:0B:0A 10.1.1.2 eth0-work
	

iface eth0-home inet static
	address 192.168.1.2
	netmask 255.255.255.0
	broadcast 192.168.1.255
	gateway 192.168.1.1

iface eth0-work inet static
	address 10.1.1.42
	netmask 255.255.255.0
	broadcast 10.1.1.255
	gateway 10.1.1.1

iface eth0-university inet dhcp

# Default for eth0
iface eth0-none inet static
	address 192.168.1.2
	netmask 255.255.255.0
	broadcast 192.168.1.255
	gateway 192.168.1.1
--------------------------------------------------------------------------

When you prepare the input data to guessnet you may need to know the MACaddress
of a remote interface in the local network.

There are many ways to do this: the easier is by using the arping utility by
issuing "arping [hostname]".

If you haven't arping installed in your system, issue the command "arp -a
[hostname]" to display the MAC address taking the information from the ARP
cache of your machine.  You might want to ping the remote interface first to be
sure to have the informations in the cache.

Have a look at the getmac script in the examples/ directory for both an example
on using these commands and a script that already does the job.


I wish you a happy networking!

Enrico