Two containers are created with this Dockerfile:

FROM ubuntu:18.04

RUN apt update && apt upgrade -y && apt install -y vim iputils-ping net-tools tcpdump iproute* iptables traceroute

The were created with the following commands in a Ubuntu 18.04 machine:

sudo docker network create --internal --subnet= netR

sudo docker network create --internal --subnet= netB1

sudo docker run --name R1_ipsec --hostname R1 --privileged --cap-add=NET_ADMIN --net netR --ip="" -dit image1
sudo docker run --name R2_ipsec --hostname R2 --privileged --cap-add=NET_ADMIN --net netR --ip="" -dit image1

sudo docker network connect --ip="" netR R1

sudo docker run --name PC1_ipsec --hostname PC1_ipsec --privileged --cap-add=NET_ADMIN --net netB1 --ip="" -dit image1

sudo docker exec PC1 route delete default gw

sudo docker exec PC1 route add default gw dev eth0

The problem: PC1 can't ping the R1's interface, even if R1 have net.ipv4.ip_forward = 1

Doker version: Docker version 18.06.1-ce, build e68fc7a


The problem was in this line:

sudo docker network create --internal --subnet= netR

The --internal option makes the network unreachable from other Docker networks.

The solution was to remove this option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.