voxpupuli / puppet-network

Types and providers to manage network interfaces
https://forge.puppet.com/puppet/network
Apache License 2.0
67 stars 107 forks source link

Dual Stack Support #304

Open pschichtel opened 11 months ago

pschichtel commented 11 months ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

network_config { "${interface} - IPv4":
    ensure  => 'present',
    name    => $interface,
    family  => 'inet4',
    method  => 'dhcp',
    hotplug => true,
}
$ipv6_config_name = "${interface} - IPv6"
network_config { $ipv6_config_name:
    ensure    => 'present',
    name      => $interface,
    family    => 'inet6',
    method    => 'static',
    hotplug   => true,
    ipaddress => "${some_ipv6_prefix}::1",
    netmask   => 64,
}
network_route { 'default':
    ensure    => 'present',
    gateway   => "${some_other_ipv6_prefix}::1",
    interface => $interface,
    netmask   => 0,
    network   => 'default',
    require   => Network_config[$ipv6_config_name],
}

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Network_config[eth0 - IPv6] to ["eth0"] at (file: .../manifests/network.pp, line: 41); resource ["Network_config", "eth0"] already declared (file: .../network.pp, line: 12) (file: .../network.pp, line: 41, column: 13) on node ...

What behaviour did you expect instead

I'm migrating from https://github.com/example42/puppet-network, which allows me to configure both IPv4 and IPv6 for the same interface.

::network::interface { "${interface} - IPv4":
    interface     => $interface,
    allow_hotplug => true,
    enable_dhcp   => true,
}
::network::interface { "${interface} - IPv6":
    interface => $interface,
    family    => 'inet6',
    auto      => false,
    ipaddress => "${some_ipv6_prefix}::1",
    netmask   => 64,
    gateway   => "${some_other_ipv6_prefix}:${vlan}::1",
}

That produced /etc/network/interfaces entries like this:

# Interface eth0 - IPv4
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# Interface eth0 - IPv6
iface eth0 inet6 static
    address ${some_ipv6_prefix}::1
    netmask 64
    gateway ${some_other_ipv6_prefix}::1

Output log

Any additional information you'd like to impart

pschichtel commented 11 months ago

example42 let me select the name and the interface independently, while this module doesn't, which prevents dual stack configurations like this. Or am I missing something?

kenyon commented 11 months ago

I can recommend using our systemd module to configure systemd-networkd instead.

pschichtel commented 11 months ago

:/ that's another evening down the drain, but the systemd module definitely seems to be in better shape