IPTable & Docker: fixing outgoing IP to a dedicated public IP (from host IP to dedicated IP)

Đã hoàn thành Đã đăng vào 2 năm trước Thanh toán khi bàn giao
Đã hoàn thành Thanh toán khi bàn giao

I have a server with a set of additional IPs on which I can launch & attach a docker instance.

The easiest way is to use -p option (-p IP:port:port) of docker.

Alternatively, we also manage to use the IPs using a dedicated docker network & a set of iptables PREROUTING/POSTROUTING rules

ie:

docker network create --driver bridge --subnet=[login to view URL] --opt "[login to view URL]"="docker1" docker1

then

/sbin/ip addr add EXTERNAL_IP dev inducido

Then

add route command for the gateway

then

iptables -t nat -A PREROUTING -d EXTERNAL_IP -j DNAT --to-destination INTERNAL_IP

and several other rules.

Everything works well, except that the outside world sees the host's IP for outgoing traffic.

I need someone expert with network & iptables to fix this, namely every packet going out of the docker instance shall be associated with the related IP.

(Debian 10 server)

Linux Quản trị hệ thống DNS Quản trị mạng Docker

ID dự án: #30203012

Về dự án

1 đề xuất Dự án từ xa 2 năm trước đang mở

Được trao cho:

udayarpandey2022

I can give it a try. May be I can help you. Thanks!

$30 USD trong 7 ngày
(225 Đánh Giá)
6.3