RHVH配置bond和vlan的几种方法

一.Anaconda installation
用户图形界面,最简单的一种。
1.bond
选择两块私网的网卡做bond,模式通常选择active backup。配置完成后多块网卡共享一个ip,实现本地网卡的冗余,带宽扩容和负载均衡。
常见模式有: (此段复制粘帖红帽官方文档)
Red Hat Enterprise Virtualization supports the following common bonding modes:

Mode 1 (active-backup policy) sets all interfaces to the backup state while one remains active. Upon failure on the active interface, a backup interface replaces it as the only active interface in the bond. The MAC address of the bond in mode 1 is visible on only one port (the network adapter), to prevent confusion for the switch. Mode 1 provides fault tolerance and is supported in Red Hat Enterprise Virtualization.
Mode 2 (XOR policy) selects an interface to transmit packages to based on the result of an XOR operation on the source and destination MAC addresses modulo NIC slave count. This calculation ensures that the same interface is selected for each destination MAC address used. Mode 2 provides fault tolerance and load balancing and is supported in Red Hat Enterprise Virtualization.
Mode 4 (IEEE 802.3ad policy) creates aggregation groups for which included interfaces share the speed and duplex settings. Mode 4 uses all interfaces in the active aggregation group in accordance with the IEEE 802.3ad specification and is supported in Red Hat Enterprise Virtualization.
Mode 5 (adaptive transmit load balancing policy) ensures the outgoing traffic distribution is according to the load on each interface and that the current interface receives all incoming traffic. If the interface assigned to receive traffic fails, another interface is assigned the receiving role instead. Mode 5 is supported in Red Hat Enterprise Virtualization. 

2.vlan
选择标有vlan 50的网卡,id就也设置成50,此外也尝试过20。具体还没有研究,似乎以10为间隔比较好。
3.vlan+bond
先设置bond,再设置vlan时选择先前设置好的bond,IPv4 disabled, IPv6 ignored。
二.ks(kickstart)文件配置
Redhat系主要有两种Kickstart和Cobbler。
Kickstart是一种无人值守的安装方式。它的工作原理是在安装过程中记录人工干预填写的各种参数,并生成一个名为ks.cfg的文件(e.g. anaconda-ks.cfg )。如果在自动安装过程中出现要填写参数的情况,安装程序首先会去查找ks.cfg文件,如果找到合适的参数,就采用所找到的参数;如果没有找到合适的参数,便会弹出对话框让安装者手工填写。所以,如果ks.cfg文件涵盖了安装过程中所有需要填写的参数,那么安装者完全可以只告诉安装程序从何处下载ks.cfg文件,然后就去忙自己的事情。等安装完毕,安装程序会根据ks.cfg中的设置重启/关闭系统,并结束安装。
Cobbler集中和简化了通过网络安装操作系统需要使用到的DHCP、TFTP和DNS服务的配置。Cobbler不仅有一个命令行界面,还提供了一个Web界面,大大降低了使用者的入门水平。Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
简单的说,Cobbler是对kickstart的封装,简化安装步骤、使用流程,降低使用者的门槛。
以下直接举例说明各网络配置时的ks文件。

KS for bond, vlan, bond+vlan

Language

lang en_US.UTF-8

Timezone

timezone Asia/Shanghai

Keyboard

keyboard --vckeymap=us --xlayouts=‘us’

Kdump

Security

User

rootpw --plaintext redhat
auth --enableshadow --passalgo=md5

Misc

services --enabled=sshd
selinux --enforcing

Installation mode

install
#liveimg url will substitued by autoframework
liveimg --url=squashfs的地址
text
reboot

Network (bond)###

network --device=bond0 --bootproto=dhcp --bondslaves=em3,em4 --bondopts=mode=active-backup,primary=em3,miimon=100

Network (vlan)###

network --device=em1 --bootproto=dhcp
network --device=em3 --bootproto=dhcp --vlanid=50

Network (bond+vlan)###

network --device=em1 --bootproto=dhcp
network --device=bond0 --bootproto=dhcp --bondslaves=em3,em4 --bondopts=mode=active-backup,primary=em3,miimon=100 --vlanid=50

Partitioning

ignoredisk --only-use=/dev/sda
zerombr
clearpart --all
bootloader --location=mbr(一般都是mbr, 也有partition等)
autopart --type=thinp

Pre deal

Post deal ###(安装之后的系统操作,如配置fips需要在此处修改)

%post --erroronfail
imgbase layout --init
%end
三.手动修改ifcfg文件
安装完系统之后,相应的网络配置文件在/etc/sysconfig/network-scripts下。
1.bond
相应网卡的ifcfg文件:(replace X with the numerical value for the interface)
DEVICE=ethX
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED=no
配置完网卡之后以root权限重启网络服务:#service network restart。
查看Bond状态, #cat /proc/net/bonding/bondN。
For example:
~]$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)
MII Status: down
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Configure a channel bonding interface ifcfg-bond0:

~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0
NAME=bond0
DEVICE=bond0
BONDING_MASTER=yes
TYPE=Bond
IPADDR=192.168.100.100
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS=“mode=active-backup miimon=100”
NM_CONTROLLED=no
2.vlan+bond
在1的基础上,确保slaves都是up的状态。
(1)Create a VLAN interface file bond0.192:

~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0.192
DEVICE=bond0.192
NAME=bond0.192
BOOTPROTO=none
ONPARENT=yes
IPADDR=192.168.10.1
NETMASK=255.255.255.0
VLAN=yes
NM_CONTROLLED=no

(2)Bring up the VLAN interface as root:

~]# ifup /etc/sysconfig/network-scripts/ifcfg-bond0.192
Determining if ip address 192.168.10.1 is already in use for device bond0.192…
3.vlan
参考2的bond0.192(但还没测试成功)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值