Use address in “Routed IPv6 Prefixes” as default outbound address when using HE.net’s tunnel brokerBy default Linux (randomly?) chooses “Client IPv6 Address” (given by HE.net) as source address for outbound connections. This can be inconvenient sometimes tough.
To override this, it’s possible to add a new address in “Routed IPv6 Prefixes” to eth0
in /etc/interfaces.d/eth0
…:
12 iface eth0 inet6 static address 2001:db8::1/64
… and abuse the definition of an IPv6 home address to override this with:
1 ip addr change 2001:db8::1 home dev eth0
To persist it, one can add a post-up
command in /etc/network/interfaces.d/eth0
:
1234 # ...iface eth0 inet6 static address 2001:db8::1/64 post-up /sbin/ip addr change 2001:db8::1 home dev eth0
Edit: At first I tried to add a script to /etc/network/if-up.d
with:
1234 #!/bin/bashset -e /sbin/ip addr change 2001:db8::1 home dev eth0
It leads to failure in starting networking.service
with RTNETLINK answers: File exists
, though. I think the reason it failed was that I should have tested interface name before setting the address as home address. Using post-up
command saves life here.
By default Linux (randomly?) chooses “Client IPv6 Address” (given by HE.net) as source address for outbound connections. This can be inconvenient sometimes tough.
To override this, it’s possible to add a new address in “Routed IPv6 Prefixes” to eth0
in /etc/interfaces.d/eth0
…:
1 2 | iface eth0 inet6 static address 2001:db8::1/64 |
… and abuse the definition of an IPv6 home address to override this with:
1 | ip addr change 2001:db8::1 home dev eth0 |
To persist it, one can add a post-up
command in /etc/network/interfaces.d/eth0
:
1 2 3 4 | # ... iface eth0 inet6 static address 2001:db8::1/64 post-up /sbin/ip addr change 2001:db8::1 home dev eth0 |
Edit: At first I tried to add a script to /etc/network/if-up.d
with:
1 2 3 4 | #!/bin/bash set -e /sbin/ip addr change 2001:db8::1 home dev eth0 |
It leads to failure in starting networking.service
with RTNETLINK answers: File exists
, though. I think the reason it failed was that I should have tested interface name before setting the address as home address. Using post-up
command saves life here.