主要介绍下面几个内容
通过koan自动重装系统;
自定义系统的安装;
示例自定义系统如何bonding及bridge;
接上一篇
#挂载centos7.1 的iso
mkdir -p /var/iso/Linux/Centos/x86_64/7.1
mount -o loop /home/CentOS-7-x86_64-DVD-1503.iso /var/iso/Linux/Centos/x86_64/7.1
cobbler import --path=/var/iso/Linux/Centos/x86_64/7.1 --name CentOS-7.1-1503-x86_64
#增加7.1的profile
cobbler profile add --name=CentOS_7.1-x86_64_server --distro=CentOS-7.1-1503-x86_64 --kickstart=/var/lib/cobbler/kickstarts/server.ks
# centos7 ks 文件配置
19、确保tftp服务已启动
lsof -i udp:69
20、利用koan自动安装系统
#koan
主机第一次安装完成后
yum install epel-release
yum install -y koan
# --display
koan --display --server=192.168.1.164 --profile=CentOS_7-x86_64_server
# --replace-self
koan --replace-self --server=192.168.1.164 --profile=CentOS_7-x86_64_server
修正不能识别centos7的故障
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
koan里面的python代码不能判断 7.0.1406的版本号,因为它太长了:( ,手动删除1406,即可顺利通过kocan重装.
centos7.1503 无上述问题
21、自定义安装,根据mac地址不同
# docker1
cobbler system add --name=docker1 --mac=d4:ae:52:72:fd:50 --ip-address=192.168.1.210 --subnet=255.255.255.0 \
--gateway=192.168.1.254 --interface=em1 --static=1 --profile=CentOS_7-x86_64_server --hostname=docker1 \
--name-servers=192.168.1.223,8.8.8.8
# docker2 在cobbler服务器上配置
cobbler system add --name=h240 --mac=18:03:73:f4:c3:32 --ip-address=192.168.1.240 --subnet=255.255.255.0 \
--gateway=192.168.1.254 --interface=em1 --static=1 --profile=CentOS_7.1-x86_64_server --hostname=docker2 \
--name-servers=192.168.1.223,8.8.8.8
# docker2 上执行重装
koan --display --server=192.168.1.164 --profile=CentOS_7.1-x86_64_server
koan --replace-self --server=192.168.1.164 --profile=CentOS_7.1-x86_64_server
# docker3 在cobbler服务器上配置
cobbler system add --name=h230 --mac=18:03:73:f4:c2:cf --ip-address=192.168.1.230 --subnet=255.255.255.0 \
--gateway=192.168.1.254 --interface=em1 --static=1 --profile=CentOS_7.1-x86_64_server --hostname=docker3 \
--name-servers=192.168.1.223,8.8.8.8
# bonding测试
cobbler system edit --name=h230 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" \
--profile=CentOS_7.1-x86_64_server --hostname=docker3 --name-servers="192.168.1.223 8.8.8.8" \
--ip-address=192.168.1.230 --subnet=255.255.255.0 --gateway=192.168.1.254 --static=1 \
cobbler system edit --name=h230 --interface=em1 --interface-type=bond_slave --mac=18:03:73:f4:c2:cf --interface-master=bond0
cobbler system edit --name=h230 --interface=em2 --interface-type=bond_slave --mac=18:03:73:f4:c2:d1 --interface-master=bond0
# docker3 上执行重装
koan --display --server=192.168.1.164 --profile=CentOS_7.1-x86_64_server
koan --replace-self --server=192.168.1.164 --profile=CentOS_7.1-x86_64_server
# 增加ubuntu安装映像
mkdir -p /var/iso/Linux/Ubuntu/x86_64/14.04
mount -o loop /root/ubuntu-14.04-desktop-amd64.iso /var/iso/Linux/Ubuntu/x86_64/14.04/
cobbler import --path=/var/iso/Linux/Ubuntu/x86_64/14.04/ --name Ubuntu-14.04-desktop
# g81
cobbler system add --name=g81 --mac=90:B1:1C:20:9C:28 --ip-address=192.168.30.81 --subnet=255.255.255.0 \
--gateway=192.168.30.1 --interface=em1 --static=1 --profile=CentOS_7-x86_64_server --hostname=g81 \
--name-servers=8.8.8.8
# g81 bonding
# 查看以前bonding的两个网卡真实mac,在已bonding的系统上通过cobbler重装应该使用两个网卡的真实mac
more /proc/net/bonding/bond0
# cobbler 定义已bonding的系统,增加bonding设置
# g81
cobbler system add --name=g81 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" \
--profile=CentOS_7.1-x86_64_server --hostname=g81 --name-servers=8.8.8.8 \
--ip-address=192.168.30.81 --subnet=255.255.255.0 --gateway=192.168.30.1 --static=1 \
#em1
cobbler system edit --name=g81 --interface=em1 --mac=90:B1:1C:20:9C:28 --interface-type=bond_slave --interface-master=bond0
#em2
cobbler system edit --name=g81 --interface=em2 --mac=90:B1:1C:20:9C:29 --interface-type=bond_slave --interface-master=bond0
#bond0
cobbler system edit --name=g81 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" \
--ip-address=192.168.30.81 --subnet=255.255.255.0 --gateway=192.168.30.1 --static=1 \
--profile=CentOS_7.1-x86_64_server --hostname=g81 --name-servers=8.8.8.8
#利用koan 重装一个已有g81系统
#显示可装系统
koan --display --server=192.168.30.41 --profile=CentOS_7.1-x86_64_server
# 重装
koan --replace-self --server=192.168.30.41 --profile=CentOS_7.1-x86_64_server
#g31 配置
#查看 bond配置
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: d4:be:d9:b4:14:9a
Slave queue ID: 0
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: d4:be:d9:b4:14:9c
Slave queue ID: 0
# 在g41 cobbler 服务器上运行针对g31的单独配置
cobbler system add --name=g31 --profile=CentOS_7.1-x86_64_server
cobbler system edit --name=g31 --interface=em1 --interface-type=bond_slave --mac=d4:be:d9:b4:14:9a --interface-master=bond0
cobbler system edit --name=g31 --interface=em2 --interface-type=bond_slave --mac=d4:be:d9:b4:14:9c --interface-master=bond0
cobbler system edit --name=g31 --interface=bond0 --interface-type=bridge_slave --interface-master=br0\
--bonding-opts="mode=active-backup miimon=100" \
--hostname=g31 --static=1
--mac=d4:be:d9:b4:14:9a
cobbler system edit --name=g31 --interface=br0 --mac=d4:be:d9:b4:14:9a --interface-type=bridge \
--hostname=g31 --static=1 \
--ip-address=192.168.30.31 --subnet=255.255.255.0 --gateway=192.168.30.1 \
--name-servers="192.168.30.11 8.8.8.8"
cobbler system add --name=g31 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" \
--profile=CentOS_7.1-x86_64_server --hostname=g31 --name-servers="192.168.30.11 8.8.8.8" \
--ip-address=192.168.30.31 --subnet=255.255.255.0 --gateway=192.168.30.1 --static=1 \
#eth0
cobbler system edit --name=g31 --interface=eth0 --mac=d4:be:d9:b4:14:9a --interface-type=bond_slave --interface-master=bond0
#eth1
cobbler system edit --name=g31 --interface=eth1 --mac=d4:be:d9:b4:14:9c --interface-type=bond_slave --interface-master=bond0
#bond0
cobbler system edit --name=g31 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" \
--ip-address=192.168.30.31 --subnet=255.255.255.0 --gateway=192.168.30.1 --static=1 \
--profile=CentOS_7.1-x86_64_server --hostname=g31 --name-servers=8.8.8.8
# h210 bond +bridge 测试
# docker1 bonding 测试成功命令
cobbler system add --name=h210 --profile=CentOS_7.1-x86_64_server
cobbler system edit --name=h210 --interface=em1 --interface-type=bond_slave --mac=d4:ae:52:72:fd:50 --interface-master=bond0
cobbler system edit --name=h210 --interface=em2 --interface-type=bond_slave --mac=d4:ae:52:72:fd:51 --interface-master=bond0
cobbler system edit --name=h210 --interface=bond0 --interface-type=bond --bonding-opts="mode=active-backup miimon=100" --hostname=docker1 --name-servers="192.168.1.236 8.8.8.8" --ip-address=192.168.1.210 --subnet=255.255.255.0 --gateway=192.168.1.254 --static=1 --mac=d4:ae:52:72:fd:50
# docker1 bonding + bridge 命令
# 创建单独的system
cobbler system add --name=h210 --profile=CentOS_7.1-x86_64_server
# 修改该system ,建立bonding ,em1 和em2 组成bonding
cobbler system edit --name=h210 --interface=em1 --interface-type=bond_slave --mac=d4:ae:52:72:fd:50 --interface-master=bond0
cobbler system edit --name=h210 --interface=em2 --interface-type=bond_slave --mac=d4:ae:52:72:fd:51 --interface-master=bond0
# 创建bond0 设备,修改类型为bridge_slave
cobbler system edit --name=h210 --interface=bond0 --interface-type=bridge_slave --interface-master=br0\
--bonding-opts="mode=active-backup miimon=100" \
--hostname=docker1 --static=1 --mac=d4:ae:52:72:fd:50
# 创建br0设备
cobbler system edit --name=h210 --interface=br0 --mac=d4:ae:52:72:fd:50 --interface-type=bridge \
--hostname=docker1 --static=1 --ip-address=192.168.1.210 --subnet=255.255.255.0 \
--gateway=192.168.1.254 --name-servers="192.168.1.236 8.8.8.8"
# 根据 profile重装
koan --replace-self --server=192.168.1.164 --profile=CentOS_7.1-x86_64_server
# 根据system重装,针对mac地址重装
koan --replace-self --server=192.168.1.164 --system=h210
阅读(4517) | 评论(0) | 转发(0) |