tony wrote: > On 19/02/2019 16:10, Greg Wooledge wrote: > > On Fri, Feb 15, 2019 at 11:11:29AM +0100, tony wrote: > >> Debian 9. I need to read my IPv6 address into a python script. > > > > Why? > > > > <https://mywiki.wooledge.org/IpAddress> may offer some insight. > > > > Well, I'm sure you don't really want to know, and I don't think your > blog covers my use case. Correct me if I'm wrong on either count. > > I have a network of IoTs consisting of 5 (I think) Paspberry Pis, > monitoring various things, and periodically sending the data to my VPS. > I need access to these hosts to manage them. > > The network supplier is Orange France (spit!) who supply a dynamic DNS > on both IPv4 and IPv6. I need to access any of them. For some years, I > have been using NAT over IPv4 with some success. I simply collect the > router's address from the server using curl, compare it with the current > DNS setting, and run nsupdate if different. > > Now, Orange (spit!) have recently discovered. IPv6, which makes > management much easier, so I'm in the process of changing over to that > protocol. Sadly the prefix is dynamic; ${deity} knows why. Each host > address is set up from router advertisement, so I figure I only need to > catch the host's current address, and set up the DNS accordingly. I'm > successfully doing that manually, but, of course, that's not very > satisfactory.
That sounds like a job for a dynamic dns client. existing Debian packages: ddclient (multiple backend services supported) ddupdate (also supports multiple services, more plugin-oriented) dyfi (Finnish users only) dyndns (multiple services) ez-ipupdate (multiple services) ipcheck (dyndns protocol specific, but many services use it) isc-dhcp-client-ddns (adds dynamic dns to DHCP) Don't reinvent the wheel, when it looks like it already has seven versions already. -dsr-