nmstate / kubernetes-nmstate

Declarative node network configuration driven through Kubernetes API.
GNU General Public License v2.0
181 stars 89 forks source link

ipv6 configuration not working for loopback devices #1218

Closed luis5tb closed 11 months ago

luis5tb commented 11 months ago

For BGP environments it may be convenient to configure IPs on the Loopback device, however this does not seems to be working as expected.

If you try to enable ipv6 but without setting an IP address:

ipv6:
   enabled: true

Then you get the error: InvalidArgument: Connection(InvalidProperty):ipv6.method: ipv6 method \"link-local\" is not supported for loopback\n'

If you try to disable it with

ipv6:
   enabled: false

You get: InvalidArgument: Loopback interface cannot be have IPv6 disabled\n'

And finally, if you fully provide information for it, for instance:

    - description: Configuring lo
      ipv4:
        address:
          - ip: 172.30.4.2
            prefix-length: 32
        enabled: true
        dhcp: false
      ipv6:
        address:
          - ip: f00d:f00d:f00d:f00d::2
            prefix-length: 128
        enabled: true
        dhcp: false
      name: lo
      mtu: 65536
      state: unknown
      type: loopback

There is no errors but the IPv6 is not configured into the loopback device

luis5tb commented 11 months ago

Follow up on this. The last bit (both configure) works the first time, then if you want to update the IP or whatever. Or if you first only configure ipv4 and then add the ipv6 bits and reapply it, it won't add any IPs

qinqon commented 11 months ago

@cathay4t do this rings any bell at nmstate side ?

cathay4t commented 11 months ago

Please change state: unknown to state: up.

luis5tb commented 11 months ago

even though if it is a loopback device?

cathay4t commented 11 months ago

nmstate ignore all interface config with state: unknown or state: ignore.

cathay4t commented 11 months ago

I will try your YAML tomorrow and feedback.

cathay4t commented 11 months ago

I have tried:

interfaces:
- name: lo
  description: Configuring lo
  type: loopback
  state: up
  mtu: 65536
  ipv4:
    enabled: true
    dhcp: false
    address:
    - ip: 172.30.4.2
      prefix-length: 32
  ipv6:
    enabled: true
    dhcp: false
    address:
    - ip: f00d:f00d:f00d:f00d::2
      prefix-length: 128

It works as expected. Can you provide more information on how to reproduce your problem?

luis5tb commented 11 months ago

perhaps the whole issue was not setting the state: up, I'll recheck and report back

luis5tb commented 11 months ago

yep, we can close this... if the state is set up up it seems to work fine! thanks! and sorry for the noise