LCFG network component
This documents the legacy version of the LCFG network component (version 1) which is used on SL7. Documentation for newer platforms (e.g. Ubuntu), which use version 2 of the component, is found at
NetworkComponent
Multi homed machines
Alias (or clone) interfaces
It is possible to configure a network interface to have two IP addresses on the same subnet using alias (or clone) interfaces. The following code adds an alias interface
eth0:1
!network.interfaces mADD(eth01)
network.device_eth01 eth0:1
network.ipaddr_eth01 129.215.212.48
network.hostname_eth01 stoater-etaps
Note that you
must specify either an IP address,or a DNS name which resolves to a single IP address, for the
ipaddr tags of all interfaces which are on the same subnet. This means that in this example, the following is also required for the primary interface.
!network.ipaddr_eth0 mSET(129.215.212.47)
Channel bonding (eg for HA)
Assuming that you have two physical interfaces eth0 and eth1 and that
both are configured such that they are visible (eg with
netstat -i
),
Create the bond0 interface :-
!hardware.modlist mADD(bond0 bond0opts)
hardware.mod_bond0 alias bond0 bonding
hardware.mod_bond0opts options bond0 mode=1 miimon=100 primary=eth0
This will create an active-backup bond interface, with eth0 being the
preferred link. Remove the
primary=eth0
setting if you don't care
which interface is used (eg when they're both the same speed).
Bond eth0 and eth1 under bond0 :-
!network.interfaces mADD(bond0 eth1)
network.hostname_bond0 <%profile.node%>
network.master_eth0 bond0
network.master_eth1 bond0
Note that you may need to set the
network.netmask_bond0
resource to
an appropriate value (the default is 255.255.255.0).
You can monitor the status of the bonded interface by reading
/proc/net/bonding/bond0
To simplify things, you can use the
<lcfg/options/etherbond.h>
header. The following will create a bonded pair from
eth0
and
eth2
:-
#define LCFG_OPTIONS_ETHERBOND_FIRST eth0
#define LCFG_OPTIONS_ETHERBOND_SECOND eth2
#include <lcfg/options/etherbond.h>
VLANs
VLANs are added using the
network.interfaces
resource (as are physical interfaces).
The
network.vlan_*tag*
resource should be set to
yes
to indicate that the interface
is a VLAN, and the
network.physdev_*tag*
should be set to the hosting physical
interface.
The following adds a VLAN with tag 252 to the eth0 interface and sets the IP address for
the VLAN interface to be that for the DNS host
bakerloo-e
.
/* Add VLAN wire DICE interface on top of eth0 */
!network.interfaces mADD(vlan252)
network.physdev_vlan252 eth0
network.vlan_vlan252 yes
network.hostname_vlan252 bakerloo-e
Note that reordering is enabled by default under SL6, and disabled by default under SL5.
Configuring to use DHCP
The network component can be instructed to use DHCP for a network interface by setting the
ipaddr tag of the interface to DHCP, eg
!network.ipaddr_eth0 mSET(DHCP)
Note that the hostname of the machine is fixed at install time.
Consistent device naming.
From RHEL 7.2 onwards, we have adopted the modern consistent device
naming scheme
.
On most desktops, the onboard network port is known as
em1. However, older desktops may name this port something else.
ConsistentNamingSchemeByModel lists the name for each model type.