[HN Gopher] Let the network tell you where you are
       ___________________________________________________________________
        
       Let the network tell you where you are
        
       Author : zdw
       Score  : 69 points
       Date   : 2024-10-02 03:45 UTC (4 days ago)
        
 (HTM) web link (rachelbythebay.com)
 (TXT) w3m dump (rachelbythebay.com)
        
       | jackweirdy wrote:
       | This couldn't have been better timed for me.
       | 
       | I sit with a pile of raspberry Pis I throw into different rooms
       | about the house and want to stick assorted tasks on them. My open
       | question was how can I just image them, plug them in and
       | centrally configure what runs on them with no more sd card or Mac
       | detection shenanigans when I change their job.
       | 
       | I'll be giving this a try!
        
         | ajb wrote:
         | If lldp proves inconvenient, pi's also have a unique cpu-id,
         | which can be found in /proc/cpuinfo
         | 
         | I think something similar exists on most processors
        
           | jagged-chisel wrote:
           | How does cpu-id map to physical location? If I move it from a
           | closet on the first floor, to a rack in the basement, how
           | does knowing the cpu-id help?
        
             | ajb wrote:
             | You would use CPU id by having the vanilla image display
             | its ID (or perhaps some more humanly readable derived name)
             | until assigned something to display. It won't know that
             | it's moved, that's an advantage of the port method.
             | 
             | I mentioned it because the OP was going to use Mac
             | addresses in a similar way, and only didn't because the Mac
             | addresses of her machines were unstable.
        
       | bagels wrote:
       | How fun, I solved a similar problem in a similar way. 90
       | identical devices, each with their own Ethernet cable and 128
       | Ethernet ports. The solution was to configure the switch to make
       | DHCP assignments based on port number, then the device could just
       | query its own IP address. Port 1 -> 192.168.1.101, 99 ->
       | 192...199
        
       | jeffrallen wrote:
       | LLDP: this is the way
       | 
       | But also, I was wondering if she was going to say, "these devices
       | have cameras on them which are not used because they are pointed
       | in random directions depending on how they are mounted". And then
       | I was hoping to see an interesting image recognition task, "given
       | this blurry, dim, random image, choose which location it probably
       | came from".
       | 
       | I got nerd sniped to the power of 2.
        
         | Rygian wrote:
         | Same could work with microphones. Every spot of the space would
         | have a different resonant characteristic.
         | 
         | Or microphone+speakers, where every device can self-assign an
         | ID, echo it over speakers, and then everyone triangulates
         | everyone else and themselves.
        
       | jtchang wrote:
       | What switches enterprise or consumer tend to support this LLDP?
       | My guess is maybe almost none on the consumer side. I.e. Netgear,
       | to link. Cisco probably does. How about ubiquti?
        
         | tcrenshaw wrote:
         | I know mikrotik supports this. On the higher end, most of the
         | Dells switches I interacted with as well as Aruba had LLDP.
         | Different manufacturers tend to report their interfaces
         | slightly differently though
        
         | hackmiester wrote:
         | Almost any managed switch will support it. Netgear does.
         | Ubiquiti definitely does, even their APs do.
        
         | client4 wrote:
         | Used Arista 7124 and 7150s are pretty cheap on Ebay.
        
         | Palomides wrote:
         | anything that can run openwrt
        
           | eqvinox wrote:
           | Nope, you need switch silicon with a driver that punts
           | 01:80:c2:0:0:0e to cpu. A lot can do this but not all
           | (generally a driver issue, not HW limitation.)
        
         | eqvinox wrote:
         | Anything with a management interface (even web) could do it
         | from the HW side, just a question of SW support. Netgear does
         | support it on managed switches.
         | 
         | The protocol is old enough and very well established by now,
         | even modern Windows boxes run it by default.
        
       | mft_ wrote:
       | Very interesting!
       | 
       | Somewhat related, years ago I worked in an office that switched
       | to hot-desking, and I spent a while trying to figure out whether
       | was there was a way to automatically generate a map of who was in
       | the office, and whereabouts. Identifying an individual laptop is
       | okay, but figuring out which docking station the laptop was
       | plugged into was a lot trickier without admin access to network
       | hardware (which I def didn't have). This approach may have
       | allowed an individual laptop to figure out where it was, and then
       | update a central location database.
        
       | pimlottc wrote:
       | I suspect this referring to a recent post on jwz's blog about his
       | digital signage solution for his nightclub, which spawned a lot
       | of discussion on the comment (click through to the blog post
       | itself):
       | 
       | https://mastodon.social/@jwz/113209773692118053
       | 
       | (intentionally linked via Mastadon because he doesn't appreciate
       | direct links from HN)
        
       | theideaofcoffee wrote:
       | You don't even need to go so far as to sniff traffic on any
       | interface. Most linux distros have either lldpd or lldapad built
       | in which gives a bit higher-level interface to the raw LLDP data
       | on the wire. The BSDs also have it. Bi-directional so info can be
       | updated switch-side too. I've used it in combination with other
       | tools, DHCP and whatnot to do something similar to what she wrote
       | about, have individual machines 'know' where they are in a
       | cabinet or facility and change functionality based on that. Works
       | great!
        
       | gruturo wrote:
       | This assumes your paranoid network admins don't disable CDP/LLDP
       | one day because of nebulous "security reasons" and sabotage your
       | scripts, but this is the wrong time and place to rant about that
       | :)
       | 
       | Cool hack!
        
         | 9x39 wrote:
         | I think that's a real risk for anyone not doing their own DIY
         | network and/or able to require the network to offer (or least
         | not block) it.
         | 
         | Depending on protocols nobody expects you to be depending on
         | can be risky, particularly with all the pathologies of working
         | with multi-team corp operations...
         | 
         | To some degree, beyond a tiny scale, building on CDP/LLDP is
         | probably fighting uphill. From my perspective working with
         | audio/visual (AV) teams and corporate IT, it's maybe safer to
         | do your location and stream management out of band in some kind
         | of overlay (app or network protocol), and just have the network
         | serve you multicast streams that you request.
         | 
         | That is, a receiving device is programmed out of band (manually
         | or by some management scripting) to subscribe to a particular
         | IP multicast stream and the network's job is just delivery
         | through IGMP+PIM. This is the rough model most AV technologies
         | seem to be following, even to the point of collapsing
         | receiver/decoder boxes into the TV itself.
         | 
         | But, sometimes there's nothing like scratching your own itch,
         | though.
        
       | eqvinox wrote:
       | LLDP-MED actually has fields for location information, though
       | they were designed for E911 on VoIP (so the switch can tell the
       | phone where it is) and might not be detailed enough.
        
       | g1sm wrote:
       | She mentioned she can't rely on DHCP for deterministic address
       | assignment, but if one _can_ rely on DHCP and has a sufficiently
       | smart switch, one can use DHCP option 82 to identify the end
       | device based on which switch and switchport it is connected to.
       | This then allows for all kinds of customizations without any
       | "cooperation" from the end device.
        
       ___________________________________________________________________
       (page generated 2024-10-06 23:01 UTC)