上篇文章我们学会了kickstart脚本中如何配置bond、bridge的方法,下面我们来看看如何配置openVswitch的方法:
由于openVwitch在系统包里并不存在,所以必须在系统装好后在%post部分中配置:
%post
# add the puppet server to hosts file
echo '200.7.4.199 puppet.mynetwork.com puppet' |tee -a /etc/hosts
# add the gateway to /etc/sysconfig/network
echo 'GATEWAY=200.7.7.2' |tee /etc/sysconfig/network
# Setup the bridge
echo 'Bridge Config'
tee /etc/sysconfig/network-scripts/ifcfg-br-ex <<BRIDGE
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=200.7.4.253
NETMASK=255.255.252.0 # your netmask
DNS1=10.1.10.1
DNS2=8.8.8.8
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
BRIDGE
# Setup the network device
echo 'ETH0 Config'
tee /etc/sysconfig/network-scripts/ifcfg-em1 <<ETH
DEVICE=em1
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
ONBOOT=yes
HWADDR=6C:F0:49:10:50:D1
NM_CONTROLLED=no
ETH
yum -yv install openvswitch
yum -yv erase NetworkManager # remove NetworkManager the normal syntax of `-NetworkManager` doesn't work
%end