Network configuration

Network configuration

Configuring the network for containers

Translating IP addresses

                                                                          _______________________
           __________________________________________________________  __| calculate container  |
          | host computer                                              |/  |                       |
          |                                   _____________________  /   | eth0 ip=192.168.11.2  |
          |                                  |                     |/|   |_______________________|
          |                                  |           veth-01 --+ |    _______________________
          |                                  |                     | |   | calculate-2 container |
  inet ---|------ eth0 ------- iptables -----+ none      veth-02 --+-----|                       |
          | ip=192.168.0.2      (NAT)        |                     | |   | eth0 ip=192.168.11.3  |
          |                                  |           veth-XX --+ |   |_______________________|
          |                                  |_____________________|\|    _______________________
          |                                            br0           \   | calculate-X container |
          |                                      ip=192.168.11.1     |\__|                       |
          |__________________________________________________________|   | eth0 ip=192.168.11.X  |
                                                                         |_______________________|

/etc/conf.d/net

config_eth0="192.168.0.2/24"
bridge_br0=""
config_br0="192.168.11.1/24"
bridge_forward_delay_br0=0
bridge_hello_time_br0=1000
bridge_stp_state_br0=0

To start the bridge, run:

ln -s /etc/init.d/net.lo /etc/init.d/net.br0

/etc/init.d/net.br0 start

Using the shared network

                                           _______________________
           ___________________________  __| calculate container  |
          | host computer               |/  |                       |
          |    _____________________  /   | eth0 ip=192.168.0.3   |
          |   |                     |/|   |_______________________|
          |   |           veth-01 --+ |    _______________________
          |   |                     | |   | calculate-2 container |
  inet ---|---+ eth0      veth-02 --+-----|                       |
          |   |                     | |   | eth0 ip=192.168.0.4   |
          |   |           veth-XX --+ |   |_______________________|
          |   |_____________________|\|    _______________________
          |            br0            \   | calculate-X container |
          |      ip=192.168.0.2       |\__|                       |
          |___________________________|   | eth0 ip=192.168.0.X   |
                                          |_______________________|

/etc/conf.d/net

config_eth0="null"
bridge_br0="eth0"
config_br0="192.168.0.2"
bridge_forward_delay_br0=0
bridge_hello_time_br0=1000
bridge_stp_state_br0=0

If the network interface name is eth0, delete the /etc/init.d/net.eth0 symlink and create /etc/init.d/net.br0:

/etc/init.d/net.eth0 stop

rm -f /etc/init.d/net.eth0

ln -s /etc/init.d/net.lo /etc/init.d/net.br0

/etc/init.d/net.br0 start