kickstart bonding安装

时间:2024-04-20 20:03:09

bonding用的是最简单的负载均衡模式,交换机不需要做配置。

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-options.html

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Establishing_a_Bond_Connection.html

pxe

default menu.c32
prompt 0
timeout 100 LABEL centos6
MENU DEFAULT
MENU LABEL 78:2b:cb:69:10:f3
KERNEL centos6/vmlinuz
APPEND initrd=centos6/initrd.img ks=http://install.localhost/kickstart/78:2b:cb:69:10:f3 ksdevice=bond0 bond=bond0:em1,em2:mode=balance-rr,miimon=100 ramdisk_size=102400 console=ttyS1,115200

kickstart

text
keyboard us
timezone Asia/Shanghai
lang en_US.UTF-8
skipx
auth --enableshadow --passalgo=sha512
rootpw --iscrypted $6$MySalt$UbCo5cq7IIOY1nl3phZbW14BsBocTV8ds/UA1nJkfjpdG0D8a7X1dbrh1lkCFw.TVfl3sjswVcuXNAgCrJKcZ. zerombr
bootloader --location=mbr --driveorder=sda part swap --fstype='swap' --ondisk=sda --size=8000
part / --fstype='ext4' --ondisk=sda --size=50000
part /opt --fstype='ext4' --ondisk=sda --size=1 --grow network --bootproto=static --device=bond0 --bondslaves=em1,em2 --bondopts=mode=balance-rr,miimon=100 --onboot=yes --ip=192.168.48.122 --netmask=255.255.255.0 --gateway=192.168.48.1 --nameserver=192.168.48.116 #network --bootproto=dhcp --device=bond0 --bondslaves=em1,em2 --bondopts=mode=balance-rr,miimon=100 --onboot=yes #mode必须使用文字模式,数字模式禁用。network使用dhcp方式时,好象分配不到ip或者dns,导致下载install.img错误。 install
url --url='http://install.local/centos6'
logging level=info firewall --disabled
selinux --disabled
services --disabled=NetworkManager,ip6tables,iptables,postfix,cpuspeed
services --enabled=network
firstboot --disabled
reboot %packages
@base
@core
%end %pre
clearpart --drives=sda --all
/usr/sbin/parted -s /dev/sda mklabel gpt
%end %post
cat > /etc/sysconfig/network-scripts/ifcfg-bond0 << _EOF_
DEVICE=bond0
IPADDR=10.150.1.213
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=balance-rr miimon=100"
_EOF_ cat > /etc/sysconfig/network-scripts/ifcfg-em1 << _EOF_
DEVICE=em1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
_EOF_ cat > /etc/sysconfig/network-scripts/ifcfg-em2 << _EOF_
DEVICE=em2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
_EOF_ %end
down vote
accepted
Network bonding : Modes of bonding Modes 0, 1, and 2 are by far the most commonly used among them. Mode 0 (balance-rr) This mode transmits packets in a sequential order from the first available slave through the last. If two real interfaces are slaves in the bond and two packets arrive destined out of the bonded interface the first will be transmitted on the first slave and the second frame will be transmitted on the second slave. The third packet will be sent on the first and so on. This provides load balancing and fault tolerance. Mode 1 (active-backup) This mode places one of the interfaces into a backup state and will only make it active if the link is lost by the active interface. Only one slave in the bond is active at an instance of time. A different slave becomes active only when the active slave fails. This mode provides fault tolerance. Mode 2 (balance-xor) Transmits based on XOR formula. (Source MAC address is XOR’d with destination MAC address) modula slave count. This selects the same slave for each destination MAC address and provides load balancing and fault tolerance. Mode 3 (broadcast) This mode transmits everything on all slave interfaces. This mode is least used (only for specific purpose) and provides only fault tolerance. Mode 4 (802.3ad) This mode is known as Dynamic Link Aggregation mode. It creates aggregation groups that share the same speed and duplex settings. This mode requires a switch that supports IEEE 802.3ad Dynamic link.
Mode 5 (balance-tlb) This is called as Adaptive transmit load balancing. The outgoing traffic is distributed according to the current load and queue on each slave interface. Incoming traffic is received by the current slave. Mode 6 (balance-alb) This is Adaptive load balancing mode. This includes balance-tlb + receive load balancing (rlb) for IPV4 traffic. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the server on their way out and overwrites the src hw address with the unique hw address of one of the slaves in the bond such that different clients use different hw addresses for the server.

balance-rr这类不依赖交换机配置的类型,可以直接使用Kickstart安装。公司有台服务器做的802.3ad绑定,在pxe引导时,卡在dhcp那里,最后dhcp失败。最后我的解决方法是:

1. 解决交换机内网部分的bonding
2. 生成不含bonding的Kickstart,仅配置内网ip
3. 系统安装完成后,登录内网Ip,配置公网部分的bonding
4. 恢复交换机内网部分的bonding
5. 登录公网Ip,配置内网部分的bonding