Docker entry [3]

8- Cross-host connection

8.1 host connection using a cross-bridge

8.1.1- bridge principle

8.1.2- combat

Environment:
Host1: br0 10.0.0.2 (Ubuntu18)
Host2: br0 10.0.0.3 (Ubuntu18)

1. apt-get install bridge-utils -y

2. vi /etc/network/interfaces
auto br0
iface br0 inet static
address 10.0.0.2
netmask 255.255.255.0
gateway 10.0.0.1
bridge_ports eth0

3. Host1 修改/etc/default/docker
-b=br0
--fixed-cidr=10.0.0.64/26

4. Host2 修改/etc/default/docker
-b=br0
--fixed-cidr=10.0.0.128/26

8.1.3- summary

Bit:
configuration is simple, does not rely on third-party software.
Disadvantages:

  • The host in the same network segment, we need to be careful division of IP address range.
  • The need for network control and difficult to achieve in a production environment.
  • Difficult to manage
  • Poor compatibility
    [PS] resulting in a production environment generally do not use bridge mode

8.2- Open vSwitch mode

8.2.1- ovs Introduction

_ _ _ Open vSwitch is a high-quality, multi-layer virtual switch, open source Apache2.0 license agreement by Nicira Networks development, the main code portable C code. The purpose is to allow large-scale network automation can be programmed to expand, while still supporting standard management interfaces and protocols (eg NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag)

8.2.2- ovs principle

8.2.3- gre tunnel

_ _ _ GRE: Generic Routing Encapsulation.
Tunneling (Tunneling) technology is a way of transmitting Internet facility data between network. Data transferred using the tunnel (or load) may be different data frames or packets. Tunneling protocol data frames or packets of other protocols repackaging then sent through the tunnel. The new header provides routing information in order to deliver the load data is encapsulated by the Internet.
Is a brief summary: repackaged point, communication between different network segments.

8.2.4- combat

Environment:
Host1: 192.168.59.103 (Ubuntu18)
Host2: 192.168.59.104 (Ubuntu18)

step:

  1. 安装ovs:
    apt-get install openvswitch-switch -y
  2. Installation of bridge management tool
    apt-get install bridge-utlis -y
  3. OVS build bridges
  4. Adding GRE connection
  5. Virtual bridge configuration docker container
  6. Add OVS interface to the virtual bridge
  7. Add different docker container network routing

For example:
HOST1


8.3- weave pattern

8.3.1- weave Introduction

_ _ _ Semantics: editor
to create a virtual network for connecting at Docker containers running on different hosts.

8.3.2- combat

step:

  • Installation weave
  • 启动weave
    weave launch
  • A different host
  • Start container through weave

For example:

[ps]: actually run container when using a weave weave

Also a host:

weave lauche ip(第一台宿主机的ip)

Run container:

weave run ip -it --name images

weave run 192.168.1.2/24 -it ubuntu /bin/bash

Guess you like

Origin www.cnblogs.com/lemanlai/p/12402308.html