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
[root@]# cat ifcfg-eth1 DEVICE=eth1 TYPE=Ethernet ONBOOT=yes BRIDGE=storage MTU=9000 [root@]# cat ifcfg-storage TYPE=Bridge ONBOOT=yes DEVICE=storage
=
Voici la configuration sous kvm / xen d'interface en bonding avec une interface en mode bridge (ifcfg-br0) qui n'a pas d'ip. L'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
Mode bridge classique
Voici la configuration sous kvm / xen d'une interface en mode bridge (ici il y a un vlan mais c'est pareil sans vlan). L'arborescence des interfaces est ainsi : ethX --> bridgeX
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. [root@]# cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static HWADDR="D4:BE:D9:AA:95:8E" ONBOOT=yes ETHTOOL_OPTS="speed 100 duplex full autoneg off" [root@]# cat ifcfg-eth0.154 BRIDGE=prive154 DEVICE=eth0.154 TYPE=Ethernet VLAN=yes ONBOOT=yes [root@]# cat ifcfg-prive154 DEVICE=prive154 TYPE=Bridge BOOTPROTO=static ONBOOT=yes VLAN=yes IPADDR=172.25.7.130 NETMASK=255.255.255.224
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
[root@]# cat ifcfg-eth0 DEVICE="eth0" ONBOOT="yes" BOOTPROTO="static" BRIDGE=admin [root@]# cat ifcfg-admin DEVICE=admin BOOTPRORO=static TYPE=Bridge ONBOOT="yes" STP=off IPADDR="172.27.125.6" NETMASK="255.255.255.0" NETWORK="172.27.125.0" BROADCAST="172.27.125.255" On peut très bien avoir un alias ip sur l'interface admin, l'interface eth0 est lié à admin mais aussi à admin:0 sans que l'on ait besoin de le préciser [root@]# cat ifcfg-admin:0 DEVICE=admin:0 NM_CONTROLLED="yes" BOOTPRORO=static TYPE=Bridge STP=off IPADDR="172.27.125.109" NETMASK="255.255.255.0" NETWORK="172.27.125.0" BROADCAST="172.27.125.255"