diff --git a/manifests/interface.pp b/manifests/interface.pp index ef89d94a017b84db4eac1d4661517dd64c055ac6..9bc1b96cf346e9b27ea0147af3a0b948ec7a5d21 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -14,10 +14,20 @@ # [*ipaddress*] # [*netmask*] # [*broadcast*] +# String. Default: undef +# Standard network parameters +# # [*hwaddr*] +# String. Default: undef +# - On RedHat: assigns this interface name to the device with this mac. +# - On Debian/Suse: spoofs mac address of the interface. +# (syntax may be broke on Debian. if so, try $macaddr). +# Do not use togehter with $macaddr. +# # [*macaddr*] # String. Default: undef -# Standard network parameters +# Spoofs mac address of the interface. +# Do not use together with $hwaddr. # # [*enable*] # Boolean. Default: true @@ -115,12 +125,6 @@ # configure the ipv4 address of the interface. # If both are present ipaddr is used. # -# $hwaddr = undef, -# hwaddr if set assigns this interface to the device with this mac. -# -# $macaddr = undef, -# macaddr if set spoofs the mac address of the interface. -# # $prefix = undef, # Network PREFIX aka CIDR notation of the network mask. The PREFIX # takes precedence if both PREFIX and NETMASK are set. @@ -575,8 +579,8 @@ define network::interface ( fail('Use either netmask or prefix to define the netmask for the interface') } - $manage_hwaddr = $hwaddr ? { - default => $hwaddr, + if $hwaddr != undef and $macaddr != undef { + fail('HWADDR and MACADDR cannot be used together') } $manage_method = $method ? { diff --git a/templates/interface/Debian.erb b/templates/interface/Debian.erb index 6c2b3e344a4bf37b6bf7372dc222bf8e2d58c107..b1489ec6ca79cf1c69bfd52b82fd2ec1b1c1733b 100644 --- a/templates/interface/Debian.erb +++ b/templates/interface/Debian.erb @@ -12,8 +12,11 @@ allow-hotplug <%= @interface %> <% if @manage_address and ! @manage_address.empty? -%> address <%= @manage_address %> <% end -%> -<% if @manage_hwaddr -%> - hwaddress <%= @manage_hwaddr %> +<% if @hwaddr -%> + hwaddress <%= @hwaddr %> +<% end -%> +<% if @macaddr -%> + hwaddress ether <%= @macaddr %> <% end -%> <% if @netmask -%> netmask <%= @netmask %> diff --git a/templates/interface/RedHat.erb b/templates/interface/RedHat.erb index e9cb5df125f27a8783c2762e382a84b1d8bc6264..4d52567162e99fe6472856717b5f1d68111d4530 100644 --- a/templates/interface/RedHat.erb +++ b/templates/interface/RedHat.erb @@ -97,8 +97,8 @@ GATEWAY="<%= @gateway %>" <% if @manage_defroute -%> DEFROUTE="<%= @manage_defroute %>" <% end -%> -<% if @manage_hwaddr -%> -HWADDR="<%= @manage_hwaddr %>" +<% if @hwaddr -%> +HWADDR="<%= @hwaddr %>" <% end -%> <% if @macaddr -%> MACADDR="<%= @macaddr %>" diff --git a/templates/interface/Suse.erb b/templates/interface/Suse.erb index 7674fbea0d9bfcd703123641194072921145d9be..1cee4f69056c681c87a462cc762726b6aab2b768 100644 --- a/templates/interface/Suse.erb +++ b/templates/interface/Suse.erb @@ -32,8 +32,11 @@ MTU="<%= @mtu %>" <% if @vlan -%> VLAN_ID="<%= @vlan %>" <% end -%> -<% if @manage_hwaddr -%> -LLADDR="<%= @manage_hwaddr %>" +<% if @hwaddr -%> +LLADDR="<%= @hwaddr %>" +<% end -%> +<% if @macaddr -%> +LLADDR="<%= @macaddr %>" <% end -%> <% if @bridge -%> BRIDGE="<%= @bridge %>"