IPTable & Docker: fixing outgoing IP to a dedicated public IP (from host IP to dedicated IP)
$10-30 USD
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)
ID dự án: #30203012