Open n454149301 opened 2 years ago
docker version
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:42 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
My English is very poor, I use machine translation, please forgive me if there is any misunderstanding.
My server uses one network port, and the switch in front of the network port has two routers. The addresses are:
I set up two static IPs, corresponding to two gateways respectively.
My requirement is that some mirrors use 192.168.11.1 as the gateway, and some mirrors use 192.168.88.127 as the gateway.
First is the netplan configuration of my ubuntu server.
A default route was manually added.
When I use the following command, I get the public network ip of the default gateway.
When I use the following command, I get the public network ip of the second gateway.
So far it has met my expectations. Next use the docker container.
First create the network.
Then start the mirror. The image I use is based on kalilinux/kali-last-release, added some tools, no other changes.
After entering the container, execute the curl command to view the public network ip.
Because the
--opt com.docker.network.host_ipv4=192.168.88.115
parameter exists. The second gateway I am using now should get the public IP of xxx.xxx.252.105.I tried to use tcpdump to capture the data packets of the network card of the physical machine, and compared the data packets of the same http request inside the container and outside the container, what is the difference.
Starting from 4500, two contents, the source IP is 192.168.88.115, and the destination IP is 122.51.162.249. The http body is all the same.
The source mac addresses are all d8:cb:8a:fa:87:8d.
It is successfully sent outside the container, and the IP of xxx.xxx.252.105 is obtained. The destination MAC is 00:e2:69:29:ed:18. It is sent in the container, and the IP of the error xxx.xxx.0.76 is obtained, and the destination MAC is 48:0e:ec:51:eb:39.
How should I configure it to achieve my needs.