Docker:将现有的旧系统转换为Dockerized形式,同时保持原始网络方案 [英] Docker: Converting an existing legacy system to Dockerized form while maintaining original network scheme

查看:117
本文介绍了Docker:将现有的旧系统转换为Dockerized形式,同时保持原始网络方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行一个项目,该项目旨在将现有的VOIP旧版系统转换为dockerized形式。现有系统由5台不同的Linux机器组成,每台机器具有2个不同的网络接口-一个暴露于公共WAN,另一个暴露于私有Lan网络。我计划创建一个docker compose文件来设置业务流程。

I'm in the midst of a project that made to convert an existing VOIP legacy system into a dockerized form. The existing system consists of 5 different Linux machines, each machine is having 2 different network interfaces - one exposed to the public WAN, and the other is a private Lan network. I plan on creating a docker compose file for setting up the orchestration.

网络大致如下:

服务器#1
Eth0:IP 192.168.0.200/24
Eth1:IP XXX65 / 27

Server #1 Eth0: IP 192.168.0.200/24 Eth1: IP X.X.X.65/27

服务器#2
Eth0:IP 192.168.0.201/24
Eth1:IP XXX66 / 27

Server #2 Eth0: IP 192.168.0.201/24 Eth1: IP X.X.X.66/27

服务器#3
Eth0:IP 192.168。 0.202 / 24
Eth1:IP XXX87 / 27

Server #3 Eth0: IP 192.168.0.202/24 Eth1: IP X.X.X.87/27

服务器#4
Eth0:IP 192.168.0.203/24
Eth1:IP YYY240 / 27

Server #4 Eth0: IP 192.168.0.203/24 Eth1: IP Y.Y.Y.240/27

服务器#5
Eth0:IP 192.168.0.204/24
Eth1:IP YYY241 / 27

Server #5 Eth0: IP 192.168.0.204/24 Eth1: IP Y.Y.Y.241/27

服务器1-3是同一子网的一部分,服务器4-5也是同一子网的一部分。

Servers 1-3 are part of the same subnet, so are servers 4-5.

我正在尝试寻找最佳方法要将这个网络设置转换为docker网络,我希望每个容器都保留他的公共IP(Eth1上的那个,这意味着从该容器生成的流量将保持与原始服务器相同的公共IP),而且还能够与每个人沟通

I am trying to find the best way to convert this network setup into docker networks, I want every container to preserve his public IP (the one on Eth1, meaning that traffic generated from the container will keep the same public IP it had on the original server), but also to be able to communicate with every other docker container on the same private net, while also keeping it easily managable and having the least overhead possible.

是否有可能在Bridge网络之间进行混合并将每个Docker容器连接到该网络上,同时又可以使其易于管理并且具有最小的开销。 ,同时为每个docker容器都具有一个Macvlan网络,该网络将在主机级别绑定到不同的网络接口?

Would it be possible to mix between a Bridge network and connect every docker container to it, while also having a Macvlan network for each docker container which will bind to a different network interface on host level?

我能否仅为主机创建2个网络接口,每个网络接口用于不同的主机子网,同时在它们上保留不同的IP地址(一个网络接口将由2个IP组成,另一个网络接口将由3个IP组成,并且每个接口将具有对应的Macvlan docker网络)?

Can I create only 2 network interfaces for the host machine, each for a different subnet, while maintaining the different IP addresses on them (one network interface will consist of 2 IPs, the other one of 3, and each interface will have a corresponding Macvlan docker network)?

EDIT

使用nmtui命令,我已经创建了一个IPv4接口具有多个IP地址,我想将3个容器连接到该网络接口,同时为每个容器提供不同的公共IP。
根据下面给出的屏幕截图,是否足以创建一个Macvlan网络并为每个容器分配自己的IPv4地址?在线阅读它并没有给我一个确切的答案,但是Docker引擎似乎可能会忽略此设置,而是为每个容器使用定义的主IP。
Essentialy,我希望每个容器都从其自己的主机IP接收流量,并从同一IP传递流量。

Using the nmtui command I've created an IPv4 interface with multiple IP addresses, I would like to connect 3 of my containers to this network interface, while providing each one of them with a different public IP. Based on the screenshot given below, would it be enough to create a single Macvlan network and assign each container with it's own IPv4 address? Reading about it online havn't provided me with a definite answer, but it seems likely that Docker engine will ignore this setting and use the defined primary IP instead for every container. Essentialy, I would like every container to receive traffic from it's own host IP, and delivere traffic from the same IP.

services:
  kamin:
    networks:
      kamin:
        priority: 1
        ipv4_address: "69.31.245.134"
networks:
  kamin:
    driver: macvlan
    driver_opts:
      parent: enp0s25
    ipam:
      config:
        - subnet: 69.30.245.130/29
          gateway: 69.31.245.129

推荐答案

我能够使用主机级别的3个网络接口和docker级别的1个自定义网桥以及2个ipvlan网络使其工作。

I was able to make it work using 3 network interfaces on host level and 1 custom bridge and 2 ipvlan networks on docker level.

这篇关于Docker:将现有的旧系统转换为Dockerized形式,同时保持原始网络方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆