Re: alias addresses both ipv4 and ipv6

From: Arthur Chance <freebsd_at_qeng-ho.org>
Date: Tue, 14 Feb 2023 09:04:50 UTC
On 14/02/2023 01:00, Ian Zimmerman wrote:
> Hello,
> sorry for the newbie question. We live in the age of migrations.
> 
> I need to have both an IPv4 and an IPv6 alias on the same net
> interface, and I am unsure of the numbers in the option names.
> If I screw this up I'll lock myself out of the system, so I
> better get it right.
> 
> This is the networking part of my rc.conf now, with the obvious
> obfuscations.
> 
> 
> ifconfig_vtnet0="DHCP -tso -rxcsum -txcsum"
> #ifconfig_vtnet0_alias0="123.123.123.161/17"
> ifconfig_vtnet0_ipv6="inet6 accept_rtadv"
> ifconfig_vtnet0_alias0="inet6 dead:beef:dead:beef::2 prefixlen 64"
> 
> The question is how to add the commented out line.
> Should it be alias0 (no conflict with the ipv6?), alias1 or what?
> 
> I have read the rc.conf manpage, and sadly it doesn't really answer
> this. It discusses each of ipv4 and ipv6 in isolation.
> 

You can mix IPv4 and IPv6 in ifconfig_???_aliases. Here's a chunk of one
of my rc.confs  - ${ix0pfx} gives the IPv6 prefix for that interface.

ifconfig_ix0_aliases=" \
        inet 172.23.1.53/32 \
        inet6 ${ix0pfx}::1:123/64 \
        inet6 ${ix0pfx}::1:143/64 \
        inet6 ${ix0pfx}::1:2525/64 \
        inet6 ${ix0pfx}::53:1/64 \
        inet6 ${ix0pfx}::a53:1/64 \
"

As you can see it's one alias per line, with inet/inet6 as relavant for
each alias.

-- 
We build our computer systems the way we build our cities; over time,
without a plan, on top of ruins.
			— Ellen Ullman