Linux网络配置1--创建Bond、配置路由和vlan

1、组建Bond。

-------------------------------[SUSE]-------------------------------------------

编辑文件/etc/sysconfig/network/ifcfg-Bond0 :

DEVICE=Bond0
IPADDR=192.170.178.41
NETMASK=255.255.255.0
BOOTPROTO=static
STARTMODE=onboot
IPV6_DAD_WAIT=0
BONDING_MASTER=yes
BONDING_MODULE_OPTS='mode=2 miimon=100 xmit_hash_policy=layer3+4'
BONDING_SLAVE0=eth0
BONDING_SLAVE1=eth1


编辑文件/etc/sysconfig/network/ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=static
STARTMODE=onboot
USERCONTROL=no


编辑文件/etc/sysconfig/network/ifcfg-ib0:

DEVICE=ib0
BOOTPROTO=static
STARTMODE=onboot
USERCONTROL=no
IPV6INIT=no
TYPE=InfiniBand
PRIMARY=yes


编辑文件/etc/sysconfig/network/ifcfg-ib1:
DEVICE=ib1
BOOTPROTO=static
STARTMODE=onboot
USERCONTROL=no
IPV6INIT=no
TYPE=InfiniBand
PRIMARY=no

------------------------------[Redhat]---------------------------------------------

编辑文件/etc/sysconfig/network-scripts/ifcfg-Bond0 :

DEVICE=Bond0
IPADDR=192.170.178.41
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
TYPE=Bonding
MTU=1500
BONDING_OPTS='mode=2 miimon=100 xmit_hash_policy=layer3+4'


编辑文件/etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=Bond0
SLAVE=yes
USERCTL=no

编辑文件/etc/sysconfig/network-scripts/ifcfg-ib0:

DEVICE=ib0
BOOTPROTO=none
ONBOOT=yes
MASTER=Bond1
SLAVE=yes
USERCTL=no
IPV6INIT=no
TYPE=InfiniBand
PRIMARY=yes

编辑文件/etc/sysconfig/network-scripts/ifcfg-ib1:

DEVICE=ib0
BOOTPROTO=none
ONBOOT=yes
MASTER=Bond1
SLAVE=yes
USERCTL=no
IPV6INIT=no
TYPE=InfiniBand
PRIMARY=yes


2、持久化路由。

-------------------------------[SUSE]-------------------------------------------

编辑文件/etc/sysconfig/network/routes:
192.168.1.200 192.168.1.1 255.255.255.0 eth2
default 192.168.100.1 - -

-------------------------------[Redhat]-------------------------------------------

编辑文件/etc/sysconfig/network-scripts/route-Bond0:
192.168.130.0/24 via 192.168.100.1
default via 192.168.100.1

3、配置vlan
-------------------------------[SUSE]-------------------------------------------
DEVICE=vlan11
IPADDR=192.168.101.3
NETMASK=255.255.255.0
BOOTPROTO=static
ETHERDEVICE=Bond0
STARTMODE=onboot
IPV6_DAD_WAIT=0
USERCONTROL=no
VLAN=yes
VLAN_ID=11
-------------------------------[Redhat]-------------------------------------------
DEVICE=vlan11
IPADDR=192.168.101.3
NETMASK=255.255.255.0
BOOTPROTO=static
PHYSDEV=Bond0
ONBOOT=yes
USERCTL=no
VLAN=yes

你可能感兴趣的:(网络,Linux/Shell)