Hi Thomas!

Am 28.12.2021 um 16:24 schrieb Thomas Bohl <openbsd-misc-518...@aloof.de>:
> 
> Hello,
> 
>> My Internet connection is using dynamic IPv6 prefixes. I want to configure a 
>> local (OpenBSD) machine so its public IPv6 address adjusts to changes in the 
>> network prefix but keeps a static Interface Identifier (IID). I’d also like 
>> to be able to configure the IID manually.
>> Essentially this would be a server running on the LAN but with a public IPv6 
>> address, reachable from the Internet.
> 
> I wrote a script that runs every minute via cron and detects a public IPv6 
> network change. On a detected change you could run for example
> 
> ifconfig $interface inet6 alias $newIPv6Net:1:2:3:4
> update-dyndns-whatever
> 
> (You configure what $interface is, and $newIPv6Net is the new network 
> prefix.) So you always (minus up to a minute) have a working :1:2:3:4 
> interface identifier.
> 
> I use the script since four years, but only now decided to publish it. I hope 
> it is self-explanatory and that my English comments make sense.
> 
> https://aloof.de/f/IPv6Aliases-en.sh
> https://aloof.de/f/IPv6Aliases-de.sh


Thanks!

You have obviously put a lot of thought into this script and solved a number of 
potential issues.


A couple of observations:
- »grep -v '^fd00‘« to remove ULA addresses is not correct. For example the ULA 
I am using at home starts with fd28:…
- Also you are taking separate steps to filter link-local and ULA addresses.
Solution to both issues: replace »grep -v '^fd00' | grep -v '^fe80‘« with »grep 
-vE '^(fe80|fd)‘«

At first I thought that using route(8) is overly complicated. But it nicely 
solves the problem of extracting the prefix which would be much more difficult 
using ifconfig(8).


Mike

Reply via email to