Defined Type: network::interface

Defined in:
manifests/interface.pp

Overview

Define: network::interface

This define manages interfaces. Currently only Debian and RedHat families supported. Some parameters are supported only for specific families

Common parameters

$enable_dhcp

Boolean. Default: false
Activates DHCP on the interface
ipaddress
netmask
broadcast
hwaddr

String. Default: undef Standard network parameters

enable

Boolean. Default: true Manages the interface presence. Possible values:

  • true - Interface created and enabled at boot.

  • false - Interface removed from boot.

template

String. Optional. Default: Managed by module. Provide an alternative custom template to use for configuration of:

  • On Debian: file fragments in /etc/network/interfaces

  • On RedHat: files /etc/sysconfig/network-scripts/ifcfg-$name

You can copy and adapt network/templates/interface/$osfamily.erb

restart_all_nic

Boolean. Default: true Manages the way to apply interface creation/modification:

  • If true, will trigger a restart of all network interfaces

  • If false, will only start/restart this specific interface

reload_command

String. Default: $::operatingsystem ? => ‘ifreload -a’,

 default        => "ifdown ${interface; ifup $interface",
}

Defines the command(s) that will be used to reload a nic when restart_all_nic is set to false

options

A generic hash of custom options that can be used in a custom template

options_extra_redhat
options_extra_debian
options_extra_suse

Custom hashes of options that are added to the default template that manages interfaces respectively under RedHat, Debian and Suse families

description

String. Optional. Default: undef Adds comment with given description in file before interface declaration.

Debian only parameters

$address       = undef,
  Both ipaddress (standard name) and address (Debian param name) if set
  configure the ipv4 address of the interface.
  If both are present address is used.
  Note, that if $my_inner_ipaddr (for GRE) is set - it is used instead.

$manage_order  = 10,
  This is used by concat to define the order of your fragments,
  can be used to load an interface before another.
  default it's 10.

$method        = '',
  Both enable_dhcp (standard) and method (Debian specific param name) if set
  configure dhcp on the interface via the method setting.
  If both are present method is used.

$up            = [ ],
$pre_up        = [ ],
$post_up        = [ ],
$down          = [ ],
$pre_down      = [ ],
$post_down      = [ ],
  Map to Debian interfaces parameters (with _ instead of -)
  Note that these params MUST be arrays, even if with only one element

$nonlocal_gateway = undef,
  Gateway, that does not belong to interface's network and needs extra
  route to be available. Shortcut for:

    post-up ip route add $nonlocal_gateway dev $interface
    post-up ip route add default via $nonlocal_gateway dev $interface
    pre-down ip route del default via $nonlocal_gateway dev $interface
    pre-down ip route del $nonlocal_gateway dev $interface

$additional_networks = [],
  Convenience shortcut to add more networks to the interface. Expands to:

    up ip addr add $network dev $interface
    down ip addr del $network dev $interface

Check the arguments in the code for the other Debian specific settings If defined they are set in the used template.

RedHat only parameters

$type          = 'Ethernet',
  Defaults to 'Ethernet', but following types are supported for OVS:
  "OVSPort", "OVSIntPort", "OVSBond", "OVSTunnel" and "OVSPatchPort".
  'InfiniBand' type is supported as well.

$ipaddr        = undef,
  Both ipaddress (standard name) and ipaddr (RedHat param name) if set
  configure the ipv4 address of the interface.
  If both are present ipaddr is used.

$hwaddr        = undef,
  hwaddr if set configures 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.

$bootproto        = '',
  Both enable_dhcp (standard) and bootproto (Debian specific param name),
  if set, configure dhcp on the interface via the bootproto setting.
  If both are present bootproto is used.

$arpcheck      = undef
  Whether the interface will check if the supplied IP address is already in
  use. Valid values are undef, "yes", "no".

$arp           = undef
  Used to enable or disable ARP completely for an interface at initialization
  Valid values are undef, "yes", "no".

$nozeroconf    = undef
  Used to enable or disable ZEROCONF routes completely for an
  interface at initialization
  Valid values are undef, "yes, 'no".

$linkdelay     = undef
  Used to introduce a delay (sleep) of the specified number of seconds when
  bringing an interface up.

$check_link_down = false
  Set to true to add check_link_down function in the interface file

$hotswap = undef
  Set to no to prevent interface from being activated when hot swapped - Default is yes

$vid = undef
  Set to specify vlan id #

RedHat and Debian only GRE interface specific parameters

$peer_outer_ipaddr = undef
  IP address of the remote tunnel endpoint

$peer_inner_ipaddr = undef
  IP address of the remote end of the tunnel interface. If this is specified,
  a route to PEER_INNER_IPADDR through the tunnel is added automatically.

$my_outer_ipaddr   = undef
  IP address of the local tunnel endpoint. If unspecified, an IP address
  is selected automatically for outgoing tunnel packets, and incoming tunnel
  packets are accepted on all local IP addresses.

$my_inner_ipaddr   = undef
  Local IP address of the tunnel interface.

RedHat only Open vSwitch specific parameters

$devicetype      = undef,
  Always set to "ovs" if configuring OVS* type.

$bond_ifaces     = undef,
  Physical interfaces for "OVSBond".

$ovs_bridge      = undef,
  For types other than "OVSBridge" type. It specifies the OVS bridge
  to which port, patch or tunnel should be attached to.

$ovs_ports       = undef,
  It specifies the OVS ports should OVS bridge attach

$ovs_extra       = undef,
  Optional: extra ovs-vsctl commands seperate by "--" (double dash)

$ovs_options     = undef,
  Optional: extra options to set in the Port table.
  Check ovs-vsctl's add-port man page.

$ovs_patch_peer  = undef,
  Patche's peer on the other bridge for "OVSPatchPort" type.

$ovs_tunnel_type = undef,
  Tunnel types (eg. "vxlan", "gre") for "OVSTunnel" type.

$ovs_tunnel_options = undef,
  Tunnel options (eg. "remote_ip") for "OVSTunnel" type.

$ovsdhcpinterfaces = undef,
  All the interfaces that can reach the DHCP server as a space separated list

$ovsbootproto = undef,
  Needs OVSBOOTPROTO instead of BOOTPROTO to enable DHCP on the bridge

Check the arguments in the code for the other RedHat specific settings If defined they are set in the used template.

RedHat only InfiniBand specific parameters

$connected_mode = undef,
   Enable or not InfiniBand CONNECTED_MODE. It true, CONNECTED_MODE=yes will
   be added to ifcfg file.

Suse and Debian only parameters

$aliases = undef
   Array of aliased IPs for given interface.
   Note, that for Debian generated interfaces will have static method and
   netmask 255.255.255.255.  If you need something other - generate
   interfaces by hand.  Also note, that interfaces will be named
   $interface:$idx, where $idx is IP index in list, starting from 0.
   If you're adding manual interfaces - beware of clashes.

Suse only parameters

Check the arguments in the code for the other Suse specific settings If defined they are set in the used template.

Red Hat zLinux on IBM ZVM/System Z (s390/s390x) only parameters

$subchannels = undef,
   The hardware addresses of QETH or Hipersocket hardware.

$nettype = undef,
   The networking hardware type.  qeth, lcs or ctc.
   The default is 'qeth'.

$layer2 = undef,
   The networking layer mode in Red Hat 6. 0 or 1.
   The defauly is 0. From Red Hat 7 this is confifured using the options
   parameter below.

$zlinux_options = undef
   You can add any valid sysfs attribute and its value to the OPTIONS
   parameter.The Red Hat Enterprise Linux (7 )installation program currently
   uses this to configure the layer mode (layer2) and the relative port
   number (portno) of qeth devices.

Parameters:

  • enable (Any) (defaults to: true)
  • ensure (Any) (defaults to: 'present')
  • template (Any) (defaults to: "network/interface/${::osfamily}.erb")
  • options (Any) (defaults to: undef)
  • options_extra_redhat (Any) (defaults to: undef)
  • options_extra_debian (Any) (defaults to: undef)
  • options_extra_suse (Any) (defaults to: undef)
  • interface (Any) (defaults to: $name)
  • restart_all_nic (Any) (defaults to: true)
  • reload_command (Any) (defaults to: undef)
  • enable_dhcp (Any) (defaults to: false)
  • ipaddress (Any) (defaults to: '')
  • netmask (Any) (defaults to: undef)
  • network (Any) (defaults to: undef)
  • broadcast (Any) (defaults to: undef)
  • gateway (Any) (defaults to: undef)
  • hwaddr (Any) (defaults to: undef)
  • mtu (Any) (defaults to: undef)
  • description (Any) (defaults to: undef)
  • manage_order (Any) (defaults to: '10')
  • auto (Any) (defaults to: true)
  • allow_hotplug (Any) (defaults to: undef)
  • method (Any) (defaults to: '')
  • family (Any) (defaults to: 'inet')
  • stanza (Any) (defaults to: 'iface')
  • address (Any) (defaults to: '')
  • dns_search (Any) (defaults to: undef)
  • dns_nameservers (Any) (defaults to: undef)
  • metric (Any) (defaults to: undef)
  • pointopoint (Any) (defaults to: undef)
  • hostname (Any) (defaults to: undef)
  • leasehours (Any) (defaults to: undef)
  • leasetime (Any) (defaults to: undef)
  • client (Any) (defaults to: undef)
  • bootfile (Any) (defaults to: undef)
  • server (Any) (defaults to: undef)
  • mode (Any) (defaults to: undef)
  • endpoint (Any) (defaults to: undef)
  • dstaddr (Any) (defaults to: undef)
  • local (Any) (defaults to: undef)
  • ttl (Any) (defaults to: undef)
  • provider (Any) (defaults to: undef)
  • unit (Any) (defaults to: undef)
  • privext (Any) (defaults to: undef)
  • dhcp (Any) (defaults to: undef)
  • media (Any) (defaults to: undef)
  • accept_ra (Any) (defaults to: undef)
  • autoconf (Any) (defaults to: undef)
  • vlan_raw_device (Any) (defaults to: undef)
  • nonlocal_gateway (Any) (defaults to: undef)
  • additional_networks (Any) (defaults to: [ ])
  • up (Any) (defaults to: [ ])
  • pre_up (Any) (defaults to: [ ])
  • post_up (Any) (defaults to: [ ])
  • down (Any) (defaults to: [ ])
  • pre_down (Any) (defaults to: [ ])
  • post_down (Any) (defaults to: [ ])
  • vrf (Any) (defaults to: undef)
  • vrf_table (Any) (defaults to: undef)
  • slaves (Any) (defaults to: [ ])
  • bond_mode (Any) (defaults to: undef)
  • bond_miimon (Any) (defaults to: undef)
  • bond_downdelay (Any) (defaults to: undef)
  • bond_updelay (Any) (defaults to: undef)
  • bond_lacp_rate (Any) (defaults to: undef)
  • bond_master (Any) (defaults to: undef)
  • bond_primary (Any) (defaults to: undef)
  • bond_slaves (Any) (defaults to: [ ])
  • bond_xmit_hash_policy (Any) (defaults to: undef)
  • bond_num_grat_arp (Any) (defaults to: undef)
  • bond_arp_all (Any) (defaults to: undef)
  • bond_arp_interval (Any) (defaults to: undef)
  • bond_arp_iptarget (Any) (defaults to: undef)
  • bond_fail_over_mac (Any) (defaults to: undef)
  • bond_ad_select (Any) (defaults to: undef)
  • use_carrier (Any) (defaults to: undef)
  • primary_reselect (Any) (defaults to: undef)
  • team_config (Any) (defaults to: undef)
  • team_port_config (Any) (defaults to: undef)
  • team_master (Any) (defaults to: undef)
  • bridge_ports (Any) (defaults to: [ ])
  • bridge_stp (Any) (defaults to: undef)
  • bridge_fd (Any) (defaults to: undef)
  • bridge_maxwait (Any) (defaults to: undef)
  • bridge_waitport (Any) (defaults to: undef)
  • wpa_ssid (Any) (defaults to: undef)
  • wpa_bssid (Any) (defaults to: undef)
  • wpa_psk (Any) (defaults to: undef)
  • wpa_key_mgmt (Any) (defaults to: [ ])
  • wpa_group (Any) (defaults to: [ ])
  • wpa_pairwise (Any) (defaults to: [ ])
  • wpa_auth_alg (Any) (defaults to: [ ])
  • wpa_proto (Any) (defaults to: [ ])
  • wpa_identity (Any) (defaults to: undef)
  • wpa_password (Any) (defaults to: undef)
  • wpa_scan_ssid (Any) (defaults to: undef)
  • wpa_ap_scan (Any) (defaults to: undef)
  • ipaddr (Any) (defaults to: '')
  • prefix (Any) (defaults to: undef)
  • uuid (Any) (defaults to: undef)
  • bootproto (Any) (defaults to: '')
  • userctl (Any) (defaults to: 'no')
  • type (Any) (defaults to: 'Ethernet')
  • ethtool_opts (Any) (defaults to: undef)
  • ipv6init (Any) (defaults to: undef)
  • ipv6_autoconf (Any) (defaults to: undef)
  • ipv6_privacy (Any) (defaults to: undef)
  • ipv6_addr_gen_mode (Any) (defaults to: undef)
  • ipv6addr (Any) (defaults to: undef)
  • ipv6addr_secondaries (Any) (defaults to: [])
  • ipv6_defaultgw (Any) (defaults to: undef)
  • dhcp_hostname (Any) (defaults to: undef)
  • srcaddr (Any) (defaults to: undef)
  • peerdns (Any) (defaults to: '')
  • peerntp (Any) (defaults to: '')
  • onboot (Any) (defaults to: '')
  • onparent (Any) (defaults to: undef)
  • defroute (Any) (defaults to: undef)
  • dns1 (Any) (defaults to: undef)
  • dns2 (Any) (defaults to: undef)
  • dns3 (Any) (defaults to: undef)
  • domain (Any) (defaults to: undef)
  • nm_controlled (Any) (defaults to: undef)
  • master (Any) (defaults to: undef)
  • slave (Any) (defaults to: undef)
  • bonding_master (Any) (defaults to: undef)
  • bonding_opts (Any) (defaults to: undef)
  • vlan (Any) (defaults to: undef)
  • vlan_name_type (Any) (defaults to: undef)
  • vlan_id (Any) (defaults to: undef)
  • vid (Any) (defaults to: undef)
  • physdev (Any) (defaults to: undef)
  • bridge (Any) (defaults to: undef)
  • arpcheck (Any) (defaults to: undef)
  • zone (Any) (defaults to: undef)
  • arp (Any) (defaults to: undef)
  • nozeroconf (Any) (defaults to: undef)
  • linkdelay (Any) (defaults to: undef)
  • check_link_down (Any) (defaults to: false)
  • hotplug (Any) (defaults to: undef)
  • persistent_dhclient (Any) (defaults to: undef)
  • nm_name (Any) (defaults to: undef)
  • connected_mode (Any) (defaults to: undef)
  • peer_outer_ipaddr (Any) (defaults to: undef)
  • peer_inner_ipaddr (Any) (defaults to: undef)
  • my_outer_ipaddr (Any) (defaults to: undef)
  • my_inner_ipaddr (Any) (defaults to: undef)
  • devicetype (Any) (defaults to: undef)
  • bond_ifaces (Any) (defaults to: undef)
  • ovs_type (Any) (defaults to: undef)
  • ovs_bonds (Any) (defaults to: undef)
  • ovs_bridge (Any) (defaults to: undef)
  • ovs_ports (Any) (defaults to: undef)
  • ovs_extra (Any) (defaults to: undef)
  • ovs_options (Any) (defaults to: undef)
  • ovs_patch_peer (Any) (defaults to: undef)
  • ovsrequires (Any) (defaults to: undef)
  • ovs_tunnel_type (Any) (defaults to: undef)
  • ovs_tunnel_options (Any) (defaults to: undef)
  • ovsdhcpinterfaces (Any) (defaults to: undef)
  • ovsbootproto (Any) (defaults to: undef)
  • subchannels (Any) (defaults to: undef)
  • nettype (Any) (defaults to: undef)
  • layer2 (Any) (defaults to: undef)
  • zlinux_options (Any) (defaults to: undef)
  • startmode (Any) (defaults to: '')
  • usercontrol (Any) (defaults to: 'no')
  • firewall (Any) (defaults to: undef)
  • aliases (Any) (defaults to: undef)
  • remote_ipaddr (Any) (defaults to: undef)
  • check_duplicate_ip (Any) (defaults to: undef)
  • send_gratuitous_arp (Any) (defaults to: undef)
  • pre_up_script (Any) (defaults to: undef)
  • post_up_script (Any) (defaults to: undef)
  • pre_down_script (Any) (defaults to: undef)
  • post_down_script (Any) (defaults to: undef)
  • bond_moduleopts (Any) (defaults to: undef)
  • bridge_fwddelay (Any) (defaults to: undef)
  • etherdevice (Any) (defaults to: undef)


253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'manifests/interface.pp', line 253

define network::interface (

  $enable                = true,
  $ensure                = 'present',
  $template              = "network/interface/${::osfamily}.erb",
  $options               = undef,
  $options_extra_redhat  = undef,
  $options_extra_debian  = undef,
  $options_extra_suse    = undef,
  $interface             = $name,
  $restart_all_nic       = true,
  $reload_command        = undef,

  $enable_dhcp           = false,

  $ipaddress             = '',
  $netmask               = undef,
  $network               = undef,
  $broadcast             = undef,
  $gateway               = undef,
  $hwaddr                = undef,
  $mtu                   = undef,

  $description           = undef,

  ## Debian specific
  $manage_order          = '10',
  $auto                  = true,
  $allow_hotplug         = undef,
  $method                = '',
  $family                = 'inet',
  $stanza                = 'iface',
  $address               = '',
  $dns_search            = undef,
  $dns_nameservers       = undef,
  # For method: static
  $metric                = undef,
  $pointopoint           = undef,

  # For method: dhcp
  $hostname              = undef,
  $leasehours            = undef,
  $leasetime             = undef,
  $client                = undef,

  # For method: bootp
  $bootfile              = undef,
  $server                = undef,

  # For method: tunnel
  $mode                  = undef,
  $endpoint              = undef,
  $dstaddr               = undef,
  $local                 = undef,
  $ttl                   = undef,

  # For method: ppp
  $provider              = undef,
  $unit                  = undef,

  # For inet6 family
  $privext               = undef,
  $dhcp                  = undef,
  $media                 = undef,
  $accept_ra             = undef,
  $autoconf              = undef,
  $vlan_raw_device       = undef,

  # Convenience shortcuts
  $nonlocal_gateway      = undef,
  $additional_networks   = [ ],

  # Common ifupdown scripts
  $up                    = [ ],
  $pre_up                = [ ],
  $post_up               = [ ],
  $down                  = [ ],
  $pre_down              = [ ],
  $post_down             = [ ],

  # For virtual routing and forwarding (VRF)
  $vrf                   = undef,
  $vrf_table             = undef,

  # For bonding
  $slaves                = [ ],
  $bond_mode             = undef,
  $bond_miimon           = undef,
  $bond_downdelay        = undef,
  $bond_updelay          = undef,
  $bond_lacp_rate        = undef,
  $bond_master           = undef,
  $bond_primary          = undef,
  $bond_slaves           = [ ],
  $bond_xmit_hash_policy = undef,
  $bond_num_grat_arp     = undef,
  $bond_arp_all          = undef,
  $bond_arp_interval     = undef,
  $bond_arp_iptarget     = undef,
  $bond_fail_over_mac    = undef,
  $bond_ad_select        = undef,
  $use_carrier           = undef,
  $primary_reselect      = undef,

  # For teaming
  $team_config           = undef,
  $team_port_config      = undef,
  $team_master           = undef,

  # For bridging
  $bridge_ports          = [ ],
  $bridge_stp            = undef,
  $bridge_fd             = undef,
  $bridge_maxwait        = undef,
  $bridge_waitport       = undef,

  # For wpa_supplicant
  $wpa_ssid              = undef,
  $wpa_bssid             = undef,
  $wpa_psk               = undef,
  $wpa_key_mgmt          = [ ],
  $wpa_group             = [ ],
  $wpa_pairwise          = [ ],
  $wpa_auth_alg          = [ ],
  $wpa_proto             = [ ],
  $wpa_identity          = undef,
  $wpa_password          = undef,
  $wpa_scan_ssid         = undef,
  $wpa_ap_scan           = undef,

  ## RedHat specific
  $ipaddr                = '',
  $prefix                = undef,
  $uuid                  = undef,
  $bootproto             = '',
  $userctl               = 'no',
  $type                  = 'Ethernet',
  $ethtool_opts          = undef,
  $ipv6init              = undef,
  $ipv6_autoconf         = undef,
  $ipv6_privacy          = undef,
  $ipv6_addr_gen_mode    = undef,
  $ipv6addr              = undef,
  $ipv6addr_secondaries  = [],
  $ipv6_defaultgw        = undef,
  $dhcp_hostname         = undef,
  $srcaddr               = undef,
  $peerdns               = '',
  $peerntp               = '',
  $onboot                = '',
  $onparent              = undef,
  $defroute              = undef,
  $dns1                  = undef,
  $dns2                  = undef,
  $dns3                  = undef,
  $domain                = undef,
  $nm_controlled         = undef,
  $master                = undef,
  $slave                 = undef,
  $bonding_master        = undef,
  $bonding_opts          = undef,
  $vlan                  = undef,
  $vlan_name_type        = undef,
  $vlan_id               = undef,
  $vid                   = undef,
  $physdev               = undef,
  $bridge                = undef,
  $arpcheck              = undef,
  $zone                  = undef,
  $arp                   = undef,
  $nozeroconf            = undef,
  $linkdelay             = undef,
  $check_link_down       = false,
  $hotplug               = undef,
  $persistent_dhclient   = undef,
  $nm_name               = undef,

  # RedHat specific for InfiniBand
  $connected_mode        = undef,

  # RedHat specific for GRE
  $peer_outer_ipaddr     = undef,
  $peer_inner_ipaddr     = undef,
  $my_outer_ipaddr       = undef,
  $my_inner_ipaddr       = undef,

  # RedHat and Debian specific for Open vSwitch
  $devicetype            = undef, # On RedHat. Same of ovs_type for Debian
  $bond_ifaces           = undef, # On RedHat Same of ovs_bonds for Debian
  $ovs_type              = undef, # Debian
  $ovs_bonds             = undef, # Debian
  $ovs_bridge            = undef,
  $ovs_ports             = undef,
  $ovs_extra             = undef,
  $ovs_options           = undef,
  $ovs_patch_peer        = undef,
  $ovsrequires           = undef,
  $ovs_tunnel_type       = undef,
  $ovs_tunnel_options    = undef,
  $ovsdhcpinterfaces     = undef,
  $ovsbootproto          = undef,

  # RedHat specific for zLinux
  $subchannels           = undef,
  $nettype               = undef,
  $layer2                = undef,
  $zlinux_options        = undef,

  ## Suse specific
  $startmode             = '',
  $usercontrol           = 'no',
  $firewall              = undef,
  $aliases               = undef,
  $remote_ipaddr         = undef,
  $check_duplicate_ip    = undef,
  $send_gratuitous_arp   = undef,
  $pre_up_script         = undef,
  $post_up_script        = undef,
  $pre_down_script       = undef,
  $post_down_script      = undef,

  # For bonding
  $bond_moduleopts       = undef,
  # also used for Suse bonding: $bond_master, $bond_slaves

  # For bridging
  $bridge_fwddelay       = undef,
  # also used for Suse bridging: $bridge, $bridge_ports, $bridge_stp

  # For vlan
  $etherdevice           = undef,
  # also used for Suse vlan: $vlan

  ) {

  include ::network

  validate_bool($auto)
  validate_bool($enable)
  validate_bool($restart_all_nic)

  validate_array($up)
  validate_array($pre_up)
  validate_array($down)
  validate_array($pre_down)
  validate_array($slaves)
  validate_array($bond_slaves)
  validate_array($bridge_ports)
  validate_array($wpa_key_mgmt)
  validate_array($wpa_group)
  validate_array($wpa_pairwise)
  validate_array($wpa_auth_alg)
  validate_array($wpa_proto)

  # $subchannels is only valid for zLinux/SystemZ/s390x.
  if $::architecture == 's390x' {
    validate_array($subchannels)
    validate_re($nettype, '^(qeth|lcs|ctc)$', "${name}::\$nettype may be 'qeth', 'lcs' or 'ctc' only and is set to <${nettype}>.")
    # Different parameters required for RHEL6 and RHEL7
    if $::operatingsystemmajrelease =~ /^7/ {
      validate_string($zlinux_options)
    } else {
      validate_re($layer2, '^0|1$', "${name}::\$layer2 must be 1 or 0 and is to <${layer2}>.")
    }
  }

  if $arp != undef and ! ($arp in ['yes', 'no']) {
    fail('arp must be one of: undef, yes, no')
  }

  if $arpcheck != undef and ! ($arpcheck in ['yes', 'no']) {
    fail('arpcheck must be one of: undef, yes, no')
  }

  if $nozeroconf != undef and ! ($nozeroconf in ['yes', 'no']) {
    fail('nozeroconf must be one of: undef, yes, no')
  }

  if $check_duplicate_ip != undef and ! ($check_duplicate_ip in ['yes', 'no']) {
    fail('check_duplicate_ip must be one of: undef, yes, no')
  }

  if $send_gratuitous_arp != undef and ! ($send_gratuitous_arp in ['yes', 'no']) {
    fail('send_gratuitous_arp must be one of: undef, yes, no')
  }

  if $::osfamily != 'RedHat' and ($type == 'InfiniBand' or $connected_mode) {
    fail('InfiniBand parameters are supported only for RedHat family.')
  }

  if $type != 'InfiniBand' and $connected_mode != undef {
    fail('CONNECTED_MODE parameter available for InfiniBand interfaces only')
  }

  $manage_hwaddr = $hwaddr ? {
    default => $hwaddr,
  }

  $manage_method = $method ? {
    ''     => $enable_dhcp ? {
      true  => 'dhcp',
      false => 'static',
    },
    default => $method,
  }

  # Debian specific
  case $manage_method {
    'auto': { $manage_address = undef }
    'bootp': { $manage_address = undef }
    'dhcp': { $manage_address = undef }
    'ipv4ll': { $manage_address = undef }
    'loopback': { $manage_address = undef }
    'manual': { $manage_address = undef }
    'none': { $manage_address = undef }
    'ppp': { $manage_address = undef }
    'wvdial': { $manage_address = undef }
    default: {
      $manage_address = $my_inner_ipaddr ? {
        undef     => $address ? {
          ''      => $ipaddress,
          default => $address,
        },
        default   => $my_inner_ipaddr,
      }
    }
  }

  # Redhat and Suse specific
  if $::operatingsystem == 'SLES' and $::operatingsystemrelease =~ /^12/ {
    $bootproto_false = 'static'
  } else {
    $bootproto_false = 'none'
  }

  $manage_bootproto = $bootproto ? {
    ''     => $enable_dhcp ? {
      true  => 'dhcp',
      false => $bootproto_false
    },
    default => $bootproto,
  }
  $manage_peerdns = $peerdns ? {
    ''     => $manage_bootproto ? {
      'dhcp'  => 'yes',
      default => 'no',
    },
    true    => 'yes',
    false   => 'no',
    default => $peerdns,
  }
  $manage_peerntp = $peerntp ? {
    ''     => $manage_bootproto ? {
      'dhcp'  => 'yes',
      default => 'no',
    },
    default => $peerntp,
  }
  $manage_ipaddr = $ipaddr ? {
    ''      => $ipaddress,
    default => $ipaddr,
  }
  $manage_onboot = $onboot ? {
    ''     => $enable ? {
      true   => 'yes',
      false  => 'no',
    },
    default => $onboot,
  }
  $manage_defroute = $defroute ? {
    true    => 'yes',
    false   => 'no',
    default => $defroute,
  }
  $manage_startmode = $startmode ? {
    ''     => $enable ? {
      true   => 'auto',
      false  => 'off',
    },
    default => $startmode,
  }

  # Resources
  $real_reload_command = $reload_command ? {
    undef => $::operatingsystem ? {
        'CumulusLinux' => 'ifreload -a',
        default        => "ifdown ${interface} --force ; ifup ${interface}",
      },
    default => $reload_command,
  }
  if $restart_all_nic == false and $::kernel == 'Linux' {
    exec { "network_restart_${name}":
      command     => $real_reload_command,
      path        => '/sbin',
      refreshonly => true,
    }
    $network_notify = "Exec[network_restart_${name}]"
  } else {
    $network_notify = $network::manage_config_file_notify
  }

  case $::osfamily {

    'Debian': {
      if $vlan_raw_device {
        if versioncmp('9.0', $::operatingsystemrelease) >= 0
        and !defined(Package['vlan']) {
          package { 'vlan':
            ensure => 'present',
          }
        }
      }

      if $network::config_file_per_interface {
        if ! defined(File['/etc/network/interfaces.d']) {
          file { '/etc/network/interfaces.d':
            ensure => 'directory',
            mode   => '0755',
            owner  => 'root',
            group  => 'root',
          }
        }
        if $::operatingsystem == 'CumulusLinux' {
          file { "interface-${name}":
            ensure  => $ensure,
            path    => "/etc/network/interfaces.d/${name}",
            content => template($template),
            notify  => $network_notify,
          }
          if ! defined(File_line['config_file_per_interface']) {
            file_line { 'config_file_per_interface':
              ensure => $ensure,
              path   => '/etc/network/ifupdown2/ifupdown2.conf',
              line   => 'addon_scripts_support=1',
              match  => 'addon_scripts_suppor*',
              notify => $network_notify,
            }
          }
        } else {
          file { "interface-${name}":
            ensure  => $ensure,
            path    => "/etc/network/interfaces.d/${name}.cfg",
            content => template($template),
            notify  => $network_notify,
          }
          if ! defined(File_line['config_file_per_interface']) {
            file_line { 'config_file_per_interface':
              ensure => $ensure,
              path   => '/etc/network/interfaces',
              line   => 'source /etc/network/interfaces.d/*.cfg',
              notify => $network_notify,
            }
          }
        }
        File['/etc/network/interfaces.d']
        -> File["interface-${name}"]
      } else {
        if ! defined(Concat['/etc/network/interfaces']) {
          concat { '/etc/network/interfaces':
            mode   => '0644',
            owner  => 'root',
            group  => 'root',
            notify => $network_notify,
          }
        }

        concat::fragment { "interface-${name}":
          target  => '/etc/network/interfaces',
          content => template($template),
          order   => $manage_order,
        }

      }

      if ! defined(Network::Interface['lo']) {
        network::interface { 'lo':
          address      => '127.0.0.1',
          method       => 'loopback',
          manage_order => '05',
        }
      }
    }

    'RedHat': {
      file { "/etc/sysconfig/network-scripts/ifcfg-${name}":
        ensure  => $ensure,
        content => template($template),
        mode    => '0644',
        owner   => 'root',
        group   => 'root',
        notify  => $network_notify,
      }
    }

    'Suse': {
      if $vlan {
        if !defined(Package['vlan']) {
          package { 'vlan':
            ensure => 'present',
          }
        }
        Package['vlan']
        -> File["/etc/sysconfig/network/ifcfg-${name}"]
      }
      if $bridge {
        if !defined(Package['bridge-utils']) {
          package { 'bridge-utils':
            ensure => 'present',
          }
        }
        Package['bridge-utils']
        -> File["/etc/sysconfig/network/ifcfg-${name}"]
      }

      file { "/etc/sysconfig/network/ifcfg-${name}":
        ensure  => $ensure,
        content => template($template),
        mode    => '0600',
        owner   => 'root',
        group   => 'root',
        notify  => $network_notify,
      }
    }

    'Solaris': {
      if $::operatingsystemrelease == '5.11' {
        if ! defined(Service['svc:/network/physical:nwam']) {
          service { 'svc:/network/physical:nwam':
            ensure => stopped,
            enable => false,
            before => [
              Service['svc:/network/physical:default'],
              Exec["create ipaddr ${title}"],
              File["hostname iface ${title}"],
            ],
          }
        }
      }
      case $::operatingsystemmajrelease {
        '11','5': {
          if $enable_dhcp {
            $create_ip_command = "ipadm create-addr -T dhcp ${title}/dhcp"
            $show_ip_command = "ipadm show-addr ${title}/dhcp"
          } else {
            $create_ip_command = "ipadm create-addr -T static -a ${ipaddress}/${netmask} ${title}/v4static"
            $show_ip_command = "ipadm show-addr ${title}/v4static"
          }
        }
        default: {
          $create_ip_command = 'true '
          $show_ip_command = 'true '
        }
      }
      exec { "create ipaddr ${title}":
        command => $create_ip_command,
        unless  => $show_ip_command,
        path    => '/bin:/sbin:/usr/sbin:/usr/bin:/usr/gnu/bin',
        tag     => 'solaris',
      }
      file { "hostname iface ${title}":
        ensure  => file,
        path    => "/etc/hostname.${title}",
        content => inline_template("<%= @ipaddress %> netmask <%= @netmask %>\n"),
        require => Exec["create ipaddr ${title}"],
        tag     => 'solaris',
      }
      host { $::fqdn:
        ensure       => present,
        ip           => $ipaddress,
        host_aliases => [$::hostname],
        require      => File["hostname iface ${title}"],
      }
      if ! defined(Service['svc:/network/physical:default']) {
        service { 'svc:/network/physical:default':
          ensure    => running,
          enable    => true,
          subscribe => [
            File["hostname iface ${title}"],
            Exec["create ipaddr ${title}"],
          ],
        }
      }
    }

    default: {
      alert("${::operatingsystem} not supported. No changes done here.")
    }

  }

}