summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/cobbler.pod22
-rw-r--r--snippets/network_config2
-rw-r--r--snippets/post_install_network_config52
-rw-r--r--snippets/pre_install_network_config25
-rw-r--r--templates/dhcp.template18
5 files changed, 92 insertions, 27 deletions
diff --git a/docs/cobbler.pod b/docs/cobbler.pod
index 19a099b6..dfe6c16d 100644
--- a/docs/cobbler.pod
+++ b/docs/cobbler.pod
@@ -231,7 +231,7 @@ A system created with name "default" has special semantics. If a default system
Specifying a mac address via --mac allows the system object to boot via PXE. If the name of the cobbler system already looks like a mac address, this is inferred from the system name and does not need to be specified.
-MAC addresses have the format AA:BB:CC:DD:EE:FF.
+MAC addresses have the format AA:BB:CC:DD:EE:FF. It's higly recommended to register your MAC-addresses in Cobbler if you're using static adressing with multiple interfaces, or if you are using any of the advanced networking features like bonding or VLANs.
=item ip
@@ -283,15 +283,29 @@ This is described further on the Cobbler Wiki.
=item --interface
By default flags like --ip, --mac, --dhcp-tag, --gateway, --subnet, and --virt-bridge operate on the first network
-interface defined for a system. Additional interfaces can be specified (0 through 7) for use with the edit command.
+interface defined for a system.
+
+Interface naming:
+
+Additional interfaces can be specified (for example: eth0, or any name you like, as long as it does not conflict with any kernel modules or other reserved names) for use with the edit command. Defining VLANs this way is also supported, of you want to add VLAN 5 on interface eth0, simply name your interface eth0:5.
Example:
cobbler system edit --name=foo --ip=192.168.1.50 --mac=AA:BB:CC:DD:EE:A0
-cobbler system edit --name=foo --interface=2 --ip=192.168.1.51 --mac=AA:BB:CC:DD:EE:A1
+cobbler system edit --name=foo --interface=eth0 --ip=192.168.1.51 --mac=AA:BB:CC:DD:EE:A1
cobbler system report foo
-NOTE: Additional interfaces can presently only be deleted via the web interface.
+NOTE: Interfaces can be deleted using the --delete-interface option.
+
+=item --bonding, --bonding-master and --bonding-opts
+
+One of the other advanced networking features supported by Cobbler is NIC bonding. You can use this to bond multiple physical network interfaces to one single logical interface to reduce single points of failure in your network. Supported values for the --bonding parameter are "master" and "slave". If "slave" is specified, you also need to define the master-interface for this bond using --bonding-master=INTERFACE. Bonding options for the master-interface may be specified using --bonding-opts="foo=1 bar=2"
+
+Example:
+
+cobbler system edit --name=foo --interface=eth0 --mac=AA:BB:CC:DD:EE:00 --bonding=slave --bonding-master=bond0
+cobbler system edit --name=foo --interface=eth1 --mac=AA:BB:CC:DD:EE:01 --bonding=slave --bonding-master=bond0
+cobbler system edit --name=foo --interface=bond0 --bonding=master --bonding-opts="mode=active-backup miimon=100" --ip=192.168.0.63 --subnet=255.255.255.0 --gateway=192.168.0.1 --static=1
=end
diff --git a/snippets/network_config b/snippets/network_config
index 80dab90d..5e74c32b 100644
--- a/snippets/network_config
+++ b/snippets/network_config
@@ -9,7 +9,7 @@
#set $configbymac = True
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
- #if $idata["mac_address"] == "" and not $vlanpattern.match($iname):
+ #if $idata["mac_address"] == "" and not $vlanpattern.match($iname) and not $idata["bonding"].lower() == "master"
#set $configbymac = False
#end if
#end for
diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config
index 84ec34c5..021ed41a 100644
--- a/snippets/post_install_network_config
+++ b/snippets/post_install_network_config
@@ -6,16 +6,25 @@
##
## Determine if we should use the MAC address to configure the interfaces first
## Only physical interfaces are required to have a MAC address
+ ## Also determine the number of bonding devices we have, so we can set the
+ ## max-bonds option in modprobe.conf accordingly.
#set $configbymac = True
+ #set $numbondingdevs = 0
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
- #if $idata["mac_address"] == "" and not $vlanpattern.match($iname):
+ #if $idata["mac_address"] == "" and not $vlanpattern.match($iname) and not $idata["bonding"].lower() == "master":
#set $configbymac = False
#end if
+ #if $idata["bonding"].lower() == "master"
+ #set $numbondingdevs += 1
+ #end if
#end for
#set $i = 0
#set $hostname = ""
-
+
+ #if $numbondingdevs > 0
+echo "options bonding max_bonds=$numbondingdevs" >> /etc/modprobe.conf
+ #end if
#for $iname in $ikeys
# Start $iname
#set $idata = $interfaces[$iname]
@@ -24,6 +33,9 @@
#set $ip = $idata["ip_address"]
#set $netmask = $idata["subnet"]
#set $gateway = $idata["gateway"]
+ #set $bonding = $idata["bonding"]
+ #set $bonding_master = $idata["bonding_master"]
+ #set $bonding_opts = $idata["bonding_opts"]
#set $ihostname = $idata["hostname"]
#set $devfile = "/etc/sysconfig/network-scripts/ifcfg-" + $iname
#if $vlanpattern.match($iname)
@@ -33,19 +45,28 @@
#else
#set $is_vlan = "false"
#end if
- #if $configbymac and $is_vlan == "false"
+ #if $bonding.lower() == "master"
+ ## Add required entry to modprobe.conf
+echo "alias $iname bonding" >> /etc/modprobe.conf
+ #end if
+ #if $configbymac and $is_vlan == "false" and $bonding.lower() != "master"
+ ## This is the code path physical interfaces will follow.
## Remove the interface file anaconda made for this mac address
-IFFILE=`grep -i "$mac" /etc/sysconfig/network-scripts/ifcfg-* | cut -d ":" -f 1`
-IFNAME=`grep "DEVICE=" \$IFFILE | cut -d "=" -f 2`
+IFNAME=\$(ifconfig | grep -i '$mac' | cut -d ' ' -f 1)
## Rename this interface in modprobe.conf
sed -i "s/\$IFNAME/$iname/" /etc/modprobe.conf
## Remove the old interface file the OS had for it
-rm -f \$IFFILE
+rm -f /etc/sysconfig/network-scripts/ifcfg-\$IFNAME
echo "DEVICE=$iname" > $devfile
-echo "HWADDR=$mac" >> $devfile
echo "ONBOOT=yes" >> $devfile
- #if $static.lower() == "true"
- #if $ip != ""
+ #if $bonding.lower() == "slave" and $bonding_master != ""
+echo "SLAVE=yes" >> $devfile
+echo "MASTER=$bonding_master" >> $devfile
+ ## Set HOTPLUG=no, see Red Hat bugzilla 442339
+echo "HOTPLUG=no" >> $devfile
+ #end if
+ #if $static.lower() == "true" or $bonding.lower() == "slave"
+ #if $ip != "" and $bonding.lower() != "slave"
## Only configure static networking if an IP-address is
## configured
echo "BOOTPROTO=static" >> $devfile
@@ -65,11 +86,18 @@ echo "BOOTPROTO=none" >> $devfile
#else
echo "BOOTPROTO=dhcp" >> $devfile
#end if
- #else if $is_vlan == "true"
- ## Handle VLAN interfaces with special care. :)
-echo "# Cobbler generated VLAN interface" > $devfile
+ #else if $is_vlan == "true" or $bonding.lower() == "master"
+ ## Handle non-physical interfaces with special care. :)
+echo "# Cobbler generated non-physical interface" > $devfile
echo "DEVICE=$iname" >> $devfile
+ #if $is_vlan == "true"
echo "VLAN=yes" >> $devfile
+ #end if
+ #if $bonding.lower() == "master" and $bonding_opts != ""
+cat >> $devfile << EOF
+BONDING_OPTS="$bonding_opts"
+EOF
+ #end if
echo "ONPARENT=yes" >> $devfile
#if $static.lower() == "true"
#if $ip != ""
diff --git a/snippets/pre_install_network_config b/snippets/pre_install_network_config
index 59f38004..4c6c27d6 100644
--- a/snippets/pre_install_network_config
+++ b/snippets/pre_install_network_config
@@ -9,7 +9,7 @@
#set $configbymac = True
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
- #if $idata["mac_address"] == "" and not $vlanpattern.match($iname):
+ #if $idata["mac_address"] == "" and not $vlanpattern.match($iname) and not $idata["bonding"].lower() == "master"
#set $configbymac = False
#end if
#end for
@@ -28,6 +28,9 @@
#set $ip = $idata["ip_address"]
#set $netmask = $idata["subnet"]
#set $gateway = $idata["gateway"]
+ #set $bonding = $idata["bonding"]
+ #set $bonding_master = $idata["bonding_master"]
+ #set $bonding_opts = $idata["bonding_opts"]
#set $ihostname = $idata["hostname"]
#set $devfile = "/etc/sysconfig/network-scripts/ifcfg-" + $iname
#if $vlanpattern.match($iname)
@@ -37,8 +40,20 @@
#else
#set $is_vlan = "false"
#end if
- #if $configbymac and $is_vlan == "false"
- ## This is a physical interface, hand it to anaconda.
+ #if ($configbymac and $is_vlan == "false" and $bonding.lower() != "slave") or $bonding.lower() == "master"
+ ## This is a physical interface, hand it to anaconda. Do not
+ ## process bonding slaves here.
+ #if $bonding.lower() == "master"
+ ## Find a slave for this interface
+ #for $tiname in $ikeys
+ #set $tidata = $interfaces[$tiname]
+ #if $tidata["bonding"].lower() == "slave" and $tidata["bonding_master"].lower() == $iname
+ #set $mac = $tidata["mac_address"]
+# Found a slave for this interface: $tiname ($mac)
+ #break
+ #end if
+ #end for
+ #end if
#if $static.lower() == "true" and $ip != ""
#if $netmask == ""
## Netmask not provided, default to /24.
@@ -66,7 +81,11 @@ then
echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config
fi
#else
+ #if $bonding.lower() == "slave"
+# Skipping (slave-interface)
+ #else
# Skipping (not a physical interface)...
+ #end if
#end if
#end for
#end if
diff --git a/templates/dhcp.template b/templates/dhcp.template
index 0204d1f5..c902b4fd 100644
--- a/templates/dhcp.template
+++ b/templates/dhcp.template
@@ -2,6 +2,9 @@
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
+# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
+# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
+# overwritten.
#
# ******************************************************************
@@ -17,13 +20,14 @@ ignore client-updates;
set vendorclass = option vendor-class-identifier;
subnet 192.168.1.0 netmask 255.255.255.0 {
- option routers 192.168.1.5;
- option subnet-mask 255.255.255.0;
- range dynamic-bootp 192.168.1.100 192.168.1.254;
- filename "/pxelinux.0";
- default-lease-time 21600;
- max-lease-time 43200;
- next-server $next_server;
+ option routers 192.168.1.5;
+ option domain-name-servers 192.168.1.1;
+ option subnet-mask 255.255.255.0;
+ range dynamic-bootp 192.168.1.100 192.168.1.254;
+ filename "/pxelinux.0";
+ default-lease-time 21600;
+ max-lease-time 43200;
+ next-server $next_server;
}
#for dhcp_tag in $dhcp_tags.keys():