network – Docker: Subnet clients can not ping another subnet

I have created a small network with 2 clients and 2 routers with this Dockerfile:

FROM Ubuntu: 18.04

Launch apt update && apt upgrade -y & install install -y vim iputils-ping iproute2

The containers were created with the following script:

#! / bin / bash

sudo docker build -t test02.

sudo docker network create a tunnel --internal --subnet = 192.168.1.0 / 24

sudo docker network create --internal --subnet = 172.16.1.0 / 24 B1
sudo docker network create --internal --subnet = 172.16.2.0 / 24 B2

sudo docker run --name R1 - hostname R1 --cap-add = ALL - network tunnel --ip = "192.168.1.100" -dit test02

sudo docker run --name R2 --hostname R2 --cap-add = ALL - tunnel tunnel --ip = "192.168.1.200" -description test02

network sudo docker connect --ip = "172.16.1.254" B1 R1
sudo docker network connect - ip = "172.16.2.254" B2 R2

sudo docker exec R1 ip route del default via 172.16.1.1

sudo docker exec R2 default route del via 172.16.2.1

sudo docker exec route ip R1 add 172.16.2.0/24 via 192.168.1.200

sudo docker exec R2 ip route add 172.16.1.0/24 via 192.168.1.100

sudo docker run --name PC1 --hostname PC1 --cap-add = ALL --net B1 --ip = "172.16.1.2" -dit test02

sudo docker run --name PC2 --hostname PC2 --cap-add = ALL --net B2 --ip = "172.16.2.2" -dit test02

sudo docker exec PC1 ip route del default via 172.16.1.1

sudo docker exec PC1 IP route add default via 172.16.1.254

sudo docker exec PC2 ip route del default via 172.16.2.1

sudo docker exec PC2 IP route add default via 172.16.2.254

Everything is fine, but PC1 can not ping PC2. This is not a problem in lxc, where do the same network configuration, PC1 and PC2 can communicate.

Why does this happen?