IPv6 addresses

Chris Dennis cgdennis at btinternet.com
Sun Mar 11 22:43:27 GMT 2012

Hello folks

I'm hacking together a quick script to parse the output from the 'ip' 
command on Linux, e.g.

$ ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet scope host lo
     inet6 ::1/128 scope host
        valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP 
qlen 1000
     link/ether 00:19:b9:06:4c:86 brd ff:ff:ff:ff:ff:ff
     inet brd scope global eth0
     inet6 2001:dead:beef:cafe::1/64 scope global dynamic
        valid_lft 86147sec preferred_lft 14147sec
     inet6 fe80::1/64 scope link
        valid_lft forever preferred_lft forever

-- which is straightforward.  But then I need to process the IPv6 
addresses to be able to extract subnet prefixes etc.

CPAN has so many IPv6-mangling modules that I don't know which to 
choose, or which will emerge as the best/most stable etc. in the future. 
  Certainly some of the ones I've looked at are badly written or badly 
documented or just plain broken.

Any recommendations?


Chris Dennis                                  cgdennis at btinternet.com
Fordingbridge, Hampshire, UK

More information about the london.pm mailing list