Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Auto-detecting network I'm connected to Alan McKinnon <alan.mckinnon@×××××.com>