ifupdown-ng / ifupdown-ng

flexible ifup/ifdown implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IPv6 on-link peer getting set for IPv4 address in Linux static executor

ptrcnull opened this issue · comments

given the following config:

auto eth0
iface eth0 inet static
    address 10.1.2.3
    netmask 255.255.255.0
    gateway 10.1.2.1

iface eth0 inet6 static
    address 2001:db8:aaaa:bbbb::1/64
    point-to-point 2001:db8:aaaa:cccc::1
    gateway 2001:db8:aaaa:cccc::1

the static script fails here:

if [ "${IF_POINT_TO_POINT}" -a "${addrfam}" = "-4" ]; then
PEER="peer ${IF_POINT_TO_POINT}"
else
PEER=""
fi
${MOCK} ip "${addrfam}" addr add "${addr}" ${PEER} dev "${IFACE}"

while trying to set 2001:db8:aaaa:cccc::1 as a peer for the v4 address

Hmm, I actually didn't think someone would want to use this for IPv6, especially when using a /64 prefix :)

I believe there was a reason for making it IPv4 only, as is stated in the man page:

point-to-point address Sets the given IPv4 address as the peer address on the interface. This setting only takes effect for the IPv4 address familiy and only makes sense in combination with a /32 netmask. For compatiblity with ifupdown and ifupdown2, pointopoint is an alias for this parameter.

To be honest I'm a little reluctant to extend this to IPv6, especially when one side is configured as /64 which is not PTP at all. This feels like

auto eth0
iface eth0 inet static
    address 10.1.2.3
    netmask 255.255.255.0
    gateway 10.1.2.1

iface eth0 inet6 static
    address 2001:db8:aaaa:bbbb::1/64
    up ip route add 2001:db8:aaaa:cccc::1/128 dev $IFACE
    down ip route del 2001:db8:aaaa:cccc::1/128 dev $IFACE
    gateway 2001:db8:aaaa:cccc::1

might be the better way to do this. This might also need up/down statements to add the gateway.

tbh i copied it from some other config and didn't know point-to-point is v4-only (the fact that it breaks everything when set on v6 is another thing obviously)

removing it entirely works though and the gateway is set correctly

Out of curiosity, did this ever work with another implementation of ifupdown?

When you say "removing it entirely", did you go the way I suggested or found another solution?

oops, sorry for the delay, forgot to reply

did this ever work with another implementation of ifupdown?

i didn't try this specific config with anything else, i meant that i had an existing config with point-to-point on v4, so i didn't read the docs and just tried to use it with v6

did you go the way I suggested or found another solution?

well, apparently the following config works just fine:

iface eth0 inet6 static
    address 2001:db8:aaaa:bbbb::1/64
    gateway 2001:db8:aaaa:cccc::1

so i just left it like that and didn't bother with adding routes manually

Cool, thanks for the update. Given that this works like this, are you OK with me closing this issue?

it would be nice if ifupdown-ng would just ignore that value instead of trying to use it with ipv4 :p

but other than that, it was just a misconfigured setup on my part, so yeah