2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2024-12-25 12:41:45 +00:00
5 cofignetwork_for_RH7
Yuan Bai edited this page 2015-11-25 15:12:48 +08:00

configuring physical nics/bond/vlan/bridge

Main Function

  1. Disable network manager, enable network service.

  2. Get nics types and nicdevice list from nics table.

  3. Configure bond/vlan/bridge, and create network interface configure file to configure bond,vlan and bridge (linux bridge or ovs bridge). For easier understanding, we assume there are physical nics eth1, eth2, eth3, eth4 which can be configured in different scenarios as bond/vlan or bridge, there are several main usage scenarios in "configuring ethx/bond/vlan/bridge" as following:

    a). Configure bond using multiple physical nics ethx.... But we will not cover bond different types of nics. we will cover bonding physical nics directly, for example, configure bond0 using eth1 and eth2:

    `bond0----eth1,eth2`
    

    b). Configure vlans for physical nics, for example, configure 2 vlans for eth1, vlan ids are 1 and 2, vlan names are eth1.1 and eth1.2;

    `eth1---eth1.1,eth1.2`
    

    c). Create bridge (linux or ovs) for physical nics ethx... directly, for example,

    `eth1---br1, eth2---br2`
    

    d). Configure vlans for physical nics, create bridge for every vlan, for example,

    `eth1---eth1.1---br11`
    
    `eth1---eth1.2---br12`
    
    `eth2---eth2.1---br21`
    
    `eth2---eth2.2---br22`
    

    e). Configure bond first, then create bridge, for example,

    `eth1,eth2,eth3---bond0---br0`
    

    f). Configure bond with different physical nics ethx..., then configure vlans using these bonds, create bridge using these vlans, for example,bonding eth1 and eth2 to create bond0, make vlan bond0.1 and bond0.2; bonding eth3 and eth4 to create bond1, make vlan bond1.11 and bond1.12, create br11 using bond1.11, create br12 using bond1.12

    `eth1,eth2---bond0---bond0.1,bond0.2`
    `bond0.1---br01`
    `bond0.2---br02`
    
    `eth3,eth4---bond1---bond1.11,bond1.12`
    `bond1.11---br11`
    `bond1.12---br12`
    

    g). If one nic nicdevice exists in compute node, configure this nic based on its nicdevice. For example, bond0 exists, then configure bridge br1 using bond0, bond0---br1

User interface

###Reuse the nics table

If reusing the nics table, old confignics and other functions that call nics table will not be affected. We can use chdef command to add nics attributes for compute node cn1.

In nics table, there are nicips, nictypes, nicnetworks and nicextraparams attributes that can be used in this function. Currently, nicips contain nics ips, for example, !|,!|,.... . nictypes contain each nic type, for example, !,!; nicnetworks contain comma-separated list of networks connected to each NIC. nicextraparams contain comma-separated list of extra parameters that will be used for each NIC configuration, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. nicextraparams will not be realized in development phase one.

Here, user interfaces for nicips,nictypes,nicnetworks and nicextraparams do not need to be changed. We use mkdef/chdef to add nicips,nictypes and nicnetworks for compute node.

In nics table, a new column nicdevice will be added to resolve relationships among physical nics/bond/vlan/bridge; We can use chdef/mkdef to add relationships attributes for node definition, then save these relationships in nics table.

Here gives an example for easier understanding user interface. Physical nics are eth2 and eth3; bonding eth2 and eth3 as bond0; from bond0, make 2 vlans: bond0.1 and bond0.2; make bridge br1 using bond0.1, make bridge br2 using bond0.2, br1 ip is 10.0.0.1, br2 ip is 20.0.0.1.

 a). Use chdef to add nicdevice to define nics relationship:

     `chdef cn1 nicdevice.br1=bond0.1 nicdevice.br2=bond0.2 nicdevice.bond0.1=bond0 nicdevice.bond0.2=bond0 nicdevice.bond0=eth2|eth3`

 b). Use chdef to add nictypes and nicnetworks:

     `chdef cn1 nictypes.eth2=ethernet nictypes.eth3=ethernet nictypes.bond0=bond nictypes.bond0.1=vlan nictypes.bond0.2=vlan nictypes.br1=bridge nictypes.br2=bridge nicips.br1=10.0.0.1 nicips.br2=20.0.0.1 nicnetworks.br1="10_0_0_0-255_0_0_0" nicnetworks.br2="20_0_0_0-255_0_0_0"`

 After executing above chdef command, we can get data from nics table as following:

      nicips column:

      `br1!10.0.0.1,br2!20.0.0.1`

      nicdevice column ( nics table use "!" and "|" to separate value ) :

      `br1!bond0.1,bond0!eth2|eth3,bond0.2!bond0,br2!bond0.2,bond0.1!bond0`

      nictypes column:

      `br1!bridge,eth2!ethernet,eth3!ethernet,bond0.2!vlan,bond0!bond,br2!bridge,bond0.1!vlan`

      nicnetworks column:

      `br1!30_0_0_0-255_0_0_0,br2!40_0_0_0-255_0_0_0`

 c). execute updatenode command to configure bond/blan/bridge in compute node

      `updatenode cn1 confignetwork`

 e). confignetwork can also be added in node definition postscripts or postbootscripts to configure bond/vlan/bridge.