In a point to point tunnel, I was able to have the same IP twice. It looks like a bug, I think that might be related to some internal representation of the netmask. It can be reproduced with the steps below.
I created a tun tunnel like this:
ip tuntap add dev tun3 mode tun user alice group alice
ip address add 10.8.0.1 peer 10.8.0.2/32 dev tun3
I listed the address:
$ ip address list dev tun3
…
inet 10.8.0.1 peer 10.8.0.2/32 scope global tun3
…
As you see, there seems to be no netmask associated with 10.8.0.1. But ifconfig reports /32:
$ ifconfig tun3
…
inet 10.8.0.1 netmask 255.255.255.255 destination 10.8.0.2
…
If I use iproute2
to add the same address 10.8.0.1/32, there is no error, the address is added and then listed.
# ip address add 10.8.0.1/32 dev tun3
$ ip address list dev tun3
…
inet 10.8.0.1 peer 10.8.0.2/32 scope global tun3
…
inet 10.8.0.1/32 scope global tun3
…
The question is, why? I was expecting a:
RTNETLINK answers: File exists
In case you wonder why I would try this, I was trying to help with this question.