Hello,
On Thu, 14 Jul 2022 14:09:52 +0900 (JST)
Masato Asou <[email protected]> wrote:
> The TUNNEL in the man ifconfig(8) is described as follows:
>
> TUNNEL
> </snip>
> tunneldomain rtable
> ^^^^^^here
> Use routing table rtable instead of the default table. The
> ^^^^^^here
> tunnel does not need to terminate in the same routing domain as
> the interface itself. rtable can be set to any valid routing
> ^^^^^^here
> table ID; the corresponding routing domain is derived from this
> table.
>
> -tunneldomain
> Use the default routing table and routing domain 0.
>
> Shouldn't rdomain be specified for TUNNELDOMAIN, not rtable?
I think it actually means rtable.
> When tunneldomain is set, rdomain is displayed and Rdomain 1 is
> created as shown below:
>
> $ netstat -R
> Rdomain 0
> Interfaces: lo0 em0 enc0 pflog0 gif0
> Routing table: 0
>
> $ doas ifconfig gif0 tunneldomain 1
> 0 asou@asou-curr: ~ 14:04:15
> $ ifconfig gif0
> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
> index 7 priority 0 llprio 3
> encap: txprio payload rxprio payload
> groups: gif
> tunnel: (unset) ttl 64 nodf ecn rdomain 1
> $ netstat -R
> Rdomain 0
> Interfaces: lo0 em0 enc0 pflog0 gif0 wg0
> Routing table: 0
>
> Rdomain 1
> Interface: lo1
> Routing table: 1
>
> $
Which version? This doesn't match my test.
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
index 3 priority 0 llprio 3
groups: lo
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
lladdr 52:54:00:12:34:56
index 1 priority 0 llprio 3
media: Ethernet autoselect (1000baseT full-duplex)
status: active
enc0: flags=0<>
index 2 priority 0 llprio 3
groups: enc
status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
index 4 priority 0 llprio 3
groups: pflog
#
# netstat -R
Rdomain 0
Interfaces: lo0 em0 enc0 pflog0
Routing table: 0
#
# ifconfig gif0 tunneldomain 1
ifconfig: SIOCSLIFPHYRTABLE: Invalid argument
#
tunneldomain X fails if X doesn't exist.
Also,
# route -T1 add 10.0.0.0/8 127.0.0.1
add net 10.0.0.0/8: gateway 127.0.0.1
#
create a rtable 1 by creating a dummy route.
# ifconfig gif0 tunneldomain 1
#
# ifconfig gif0
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
index 5 priority 0 llprio 3
encap: txprio payload rxprio payload
groups: gif
tunnel: (unset) ttl 64 nodf ecn rdomain 1
the command becomes ok.
#
# netstat -R
Rdomain 0
Interfaces: lo0 em0 enc0 pflog0 gif0
Routing tables: 0 1
# sysctl kern.version
kern.version=OpenBSD 7.1 (GENERIC.MP) #465: Mon Apr 11 18:03:57 MDT 2022
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
#
It seems a rtable can be specified for "tunneldomain".