Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Cc: Maciej Grela <maciej.grela@×××××.com>
Subject: Re: [gentoo-user] Auto-detecting network I'm connected to
Date: Fri, 22 Oct 2010 10:13:53
Message-Id: 201010221214.26240.alan.mckinnon@gmail.com
In Reply to: Re: [gentoo-user] Auto-detecting network I'm connected to by Maciej Grela
1 Apparently, though unproven, at 01:14 on Friday 22 October 2010, Maciej Grela
2 did opine thusly:
3
4 > 2010/10/21 Alan McKinnon <alan.mckinnon@×××××.com>:
5 > > Hi all,
6 > >
7 > > One gentoo notebook running wicd, three general classes of network logon
8 > > used frequently (dhpc always):
9 > >
10 > > work - mostly wired, occasionally wireless. There's a plethora of APs to
11 > > pick from, some official, some rogue. And not all end up being served by
12 > > the same dhcp server, or even be in sync with each other.
13 > > home - Easy one. Usually wireless, sometimes wired. I control the router.
14 > > everything else - friend's houses, other companies, wifi hotspots.
15 > >
16 > > Thanks to our IT division I get lots of practice in finding interesting
17 > > ways into the corporate network. Depending on how I'm connected I start
18 > > up all manner of tunnels, socks proxies and various other bits. Doing
19 > > this manually is getting tedious.
20 > >
21 > > So I'm looking for a reasonably reliable way of detecting what served my
22 > > current IP address so the post-start script in wicd can detect this and
23 > > launch all the correct things correctly. The actual address range and
24 > > domain is not the way to go - too many networks dish out 10.0.0.0/8 and
25 > > example.com for that to work well.
26 > >
27 > > I have some ideas of my own, but figured I'd ask here as well. Odds are
28 > > excellent someone will have much better ideas than I.
29 >
30 > There are a few metrics you can use to identify a "network" you are on:
31 >
32 > 1. ESSID and AP MAC in case of wireless
33 > 2. MAC address of DHCP server that served you the address (can be also
34 > used to alarm you when DHCP-spoofing is detected).
35 > 3. MAC addresses of hosts provided by DHCP (gateway and DNS usually).
36 > 4. CDP or LLDP traffic on your interface (usually present in corporate
37 > LANs).
38 >
39 > There was once a feature in gentoo, which involved loading different
40 > network profiles from /etc/conf.d/net depending on the IP address of
41 > the gateway offered by DHCP. It worked pretty well in the days before
42 > networkmanager and wicd.
43
44
45 Thanks for this, it gives me some ideas to work on further.
46
47
48 --
49 alan dot mckinnon at gmail dot com