razorsedge / puppet-network

Puppet module to manage Red Hat/Fedora traditional network configuration.
http://forge.puppetlabs.com/razorsedge/network
Other
55 stars 140 forks source link

VLAN definition doesn't create correct configuration #104

Open sandynomad opened 8 years ago

sandynomad commented 8 years ago

Configuration file for an interface with a VLAN (ie: ifcfg-enp6s0f0.330) appears to be missing 'VLAN=yes'

The following config:

network::if::static { 'enp6s0f0.330': ensure => 'up', ipaddress => '10.2.3.248', netmask => '255.255.255.0', }

Generates:

File managed by Puppet

DEVICE=enp6s0f0.330 BOOTPROTO=none HWADDR=.... ONBOOT=yes HOTPLUG=yes TYPE=Ethernet IPADDR=10.2.3.248 NETMASK=255.255.255.0 PEERDNS=no NM_CONTROLLED=no

However the mandatory variable 'VLAN=yes' is missing.

Refer to:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Configure_802_1Q_VLAN_Tagging_Using_the_Command_Line.html#sec-Setting_Up_802.1Q_VLAN_Tagging_Using_ifcfg_Files

matschundbrei commented 6 years ago

While the RHEL Docs clearly state this, /usr/sbin/ifup on CO7 includes the 'global' /etc/sysconfig/network file upon starting (not sure about other distros in the rhel family).

For VLANs to be activated it is sufficient to use it only once in this file, and then all adapters that are matching MATCH='^.+\.[0-9]{1,4}$' and are not an alias will get the VLAN-ID from that match attached.

There is a risk because the VLAN matching will be done for each interface on the host when VLAN=yes is set in the 'global' /etc/sysconfig/network file. This might have implications on other interfaces named that way by accident, choice or habit.

I would suggest to either add define network::if::vlan or allow "VLAN=yes" to be set on interface level while removing it from global entirely.