• Welcome to Hurricane Electric's IPv6 Tunnel Broker Forums.

[FreeBSD] Setting default source address?

Started by jemann, January 30, 2013, 05:55:22 AM

Previous topic - Next topic

jemann

Hello forum.

I've successfully configured my hosted FreeBSD server to use a HE.net IPv6 tunnel.  My gif0 tunnel interface has the "Client IPv6 address" as it's primary and I've also added a few of the addresses from the routed /64 range as aliases on that interface, as follows:

gif0: flags=8151<UP,POINTOPOINT,RUNNING,PROMISC,MULTICAST> metric 0 mtu 1280
       tunnel inet 31.193.132.199 --> 216.66.80.26
       inet6 2001:470:1f08:84f::2 --> 2001:470:1f08:84f::1 prefixlen 128
       inet6 fe80::be30:5bff:feda:b396%gif0 prefixlen 64 scopeid 0x7
       inet6 2001:470:1f09:84f:: prefixlen 64
       inet6 2001:470:1f09:84f::1 prefixlen 64
       inet6 2001:470:1f09:84f::2 prefixlen 64
       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
       options=1<ACCEPT_REV_ETHIP_VER>


The primary and alias addresses are all pingable from elsewhere.

However, IPv6 traffic originating from my host uses gif0's primary address (the tunnel endpoint IP) as its source address.  How can I make outgoing traffic originate from one of the alias address instead?

Was it a good idea to set up those additional addresses as aliases on the tunnel interface, or would it have been better to do it a different way?

Thanks for any advice.

snarked

Unix-based OS:  "man ip".  You're looking for "ip addrlabel".

jemann

#2
FreeBSD doesn't have the 'ip' command.

The 'ifconfig' manpage makes no mention of a 'addrlabel' parameter either.

However, there is an inet6-specific interface flag named "prefer_source" that looks promising.  I'll give that a try.

jemann

A reply to my similar post on the FreeBSD forums suggested an undocumented "deprecated" flag that can be set on an interface address.  This worked perfectly:

# ifconfig gif0 inet6 2001:470:1f08:84f::2 2001:470:1f08:84f::1 prefixlen 128 deprecated
# ifconfig gif0
gif0: flags=8151<UP,POINTOPOINT,RUNNING,PROMISC,MULTICAST> metric 0 mtu 1280
        tunnel inet 31.193.132.199 --> 216.66.80.26
        inet6 fe80::be30:5bff:feda:b396%gif0 prefixlen 64 scopeid 0x7
        inet6 2001:470:1f09:84f::1 prefixlen 64
        inet6 2001:470:1f09:84f::2 prefixlen 64
        inet6 2001:470:1f09:84f:: prefixlen 64
        inet6 2001:470:1f09:84f::3 prefixlen 64
        inet6 2001:470:1f09:84f::5e4c:dad4 prefixlen 64
        inet6 2001:470:1f09:84f::5e4c:dad5 prefixlen 64
        inet6 2001:470:1f09:84f::1fc1:84c7 prefixlen 64
        inet6 2001:470:1f08:84f::2 --> 2001:470:1f08:84f::1 prefixlen 128 deprecated
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        options=1<ACCEPT_REV_ETHIP_VER>
# ping6 home.b0rken.org
PING6(56=40+8+8 bytes) 2001:470:1f09:84f::1 --> 2001:470:1f08:84e::2