Config reseau bridge
Cette page recense tous les types de configuration avec des interfaces en mode bridge que l'on peut avoir. Cela est principalement mis en place sur des hyperviseurs avec des vm derrières.
Le nom de l'interface bridge peut avoir n'importe quel nom. Dans le cas ou l'on a des vlan, il est préférable de tagguer l'interface au niveau de l'hyperviseur et non au niveau de la vm.
Mode bridge simple
Interface sans ip, sans vlan. Les vm qui seront derrières cette interface seront donc toutes derrières le même subnet. Arborescence des interfaces : ethX --> bridge
[root@]# cat ifcfg-eth1 DEVICE=eth1 TYPE=Ethernet ONBOOT=yes BRIDGE=storage MTU=9000 [root@]# cat ifcfg-storage TYPE=Bridge ONBOOT=yes DEVICE=storage
Mode bridge avec ip & alias
On peut très bien avoir un alias ip sur l'interface bridgé, l'interface eth0 est lié à admin mais aussi à admin:0 sans que l'on ait besoin de le préciser.
[root@]# cat ifcfg-eth0 DEVICE="eth0" ONBOOT="yes" BOOTPROTO="static" BRIDGE=admin [root@]# cat ifcfg-admin DEVICE=admin BOOTPRORO=static TYPE=Bridge ONBOOT="yes" IPADDR="172.27.125.6" NETMASK="255.255.255.0" [root@]# cat ifcfg-admin:0 DEVICE=admin:0 BOOTPRORO=static TYPE=Bridge IPADDR="172.27.125.109" NETMASK="255.255.255.0"
Mode bridge + vlan avec et sans ip
L'interface principale (ethX) doit toujours etre montée, sinon les alias ou vlan (eth0:1 ou eth0.122) liés à cette interface ne monteront pas. Arborescence des interfaces : ethX --> eth.vlan --> bridge
[root@]# cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static ONBOOT=yes [root@]# cat ifcfg-eth0.130 DEVICE=eth0.13 ONBOOT=yes BRIDGE=front132 VLAN=yes [root@]# cat ifcfg-front130 DEVICE="front130" BOOTPROTO="static" ONBOOT="yes" TYPE=Bridge [root@]# cat ifcfg-eth0.619 DEVICE=eth0.619 ONBOOT=yes BRIDGE=front619 VLAN=yes [root@]# cat ifcfg-front132 DEVICE=front132 ONBOOT=yes IPADDR=172.30.102.105 NETMASK=255.255.255.240 TYPE=Bridge
Mode bridge + bonding
Voici la configuration sous kvm / xen d'interface en bonding avec une interface en mode bridge (ifcfg-br0) qui n'a pas d'ip. Arborescence des interfaces est ainsi : ethX --> bondX --> bridgeX
[root@]# cat ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes [root@]# cat ifcfg-eth1 DEVICE=eth1 ONBOOT=yes BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes [root@]# cat ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none ONBOOT=yes BRIDGE=br0 BONDING_OPTS="mode=4 miimon=100" [root@]# cat ifcfg-br0 DEVICE=br0 TYPE=Bridge BOOTPROTO=static ONBOOT=yes BOOTPRORO=none
L'interface principale (eth0 ou eth1) doit toujours etre montée, sinon les alias ou vlan (eth0:1 ou eth0.122) liés à cette interface ne monteront pas. === Mode bridge avec ip === Voici la configuration sous kvm / xen d'interface en bonding avec une interface qui a une ip. Le nom du device admin peut avoir n'importe quel nom. L'arborescence des interfaces est ainsi : ethX --> admin