jpetazzo/pipework

Cannot set static ipv4 and ipv6 to the same new interface on the container.

Closed this issue · 2 comments

I cannot set a static IPv6 address to an interface previously configured with IPv4 using pipework

* sudo pipework br4 -i eth1 634f98b6dafd 192.168.44.1/24@192.168.44.100*

root@634f98b6dafd:/tmp/pjproject-2.3# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 6e:8e:4b:06:8e:af  
          inet addr:192.168.44.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::6c8e:4bff:fe06:8eaf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6664 (6.6 KB)  TX bytes:942 (942.0 B)

root@634f98b6dafd:/tmp/pjproject-2.3# 

root@634f98b6dafd:/tmp/pjproject-2.3# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.44.100  0.0.0.0         UG    0      0        0 eth1
172.17.0.0      *               255.255.0.0     U     0      0        0 eth0
192.168.44.0    *               255.255.255.0   U     0      0        0 eth1
root@634f98b6dafd:/tmp/pjproject-2.3# 

Static IPv6 configuration doesn't work:

sudo pipework br4 -i eth1 634f98b6dafd 2001:db8:44::1/64@2001:db8:44::100
** RTNETLINK answers: File exists**

But the interface is capable of aquiring an IPv6 (through SLAAC) and an IPv6 gateway as soon as the bridge br4 it is connected to a router

root@e69cbaae4ce2:/tmp/pjproject-2.3# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 62:d2:c7:3f:f1:c7  
          inet addr:192.168.44.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: 2001:db8:44:0:60d2:c7ff:fe3f:f1c7/64 Scope:Global
          inet6 addr: fe80::60d2:c7ff:fe3f:f1c7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:88 errors:0 dropped:15 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10698 (10.6 KB)  TX bytes:768 (768.0 B)

root@e69cbaae4ce2:/tmp/pjproject-2.3# route -6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
2001:db8:44::/64               ::                         UAe  256 0     0 eth1
fe80::/64                      ::                         U    256 0     0 eth0
fe80::/64                      ::                         U    256 0     0 eth1
** ::/0                           fe80::a8bb:ccff:fe00:100   UGDAe 1024 0     0 eth1**
::/0                           ::                         !n   -1  1     1 lo
::1/128                        ::                         Un   0   1     0 lo
2001:db8:44:0:60d2:c7ff:fe3f:f1c7/128 ::                         Un   0   1     0 lo
fe80::42:acff:fe11:4/128       ::                         Un   0   1     0 lo
fe80::60d2:c7ff:fe3f:f1c7/128  ::                         Un   0   1     0 lo
ff00::/8                       ::                         U    256 0     0 eth0
ff00::/8                       ::                         U    256 1     0 eth1
::/0                           ::                         !n   -1  1     1 lo

It is worth mentioning that it is the same the other way around:
If I create a new interface and 1st assign an IPv6 address and gateway to it, I cannot add to it an IPv4 address:
RTNETLINK answers: File exists

Hi,
I've created a PR yesterday, where I try to manage most of the common use-cases.
See #122