結論

net.ipv4.conf.all.forwarding = 0になっているので、1にする。

$ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.all.forwarding = 0
$ sudo sysctl net.ipv4.conf.all.forwarding=1 net.ipv4.conf.all.forwarding = 1 $ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.all.forwarding = 1

事の発端

HostからVagrant経由で、Dockerにアクセスしてもなぜか繋がらなくなった。 ↓ docker-composeでビルドし直してみる。

$ docker-compose build --no-cache .... IPv4 forwarding is disabled. Networking will not work
apt-getでパッケージupdateしようとした所、外部に出ていけなくなっていた。 ↓ Vagrant上の、CentOSの、net.ipv4.conf.all.forwardingが 0 になっていて、外部に出れなくなっていた。

原因

ネットワークの再起動で、

sysctl -w net.ipv4.ip_forward=0 > /dev/null 2>&1
となっている。

対策

/etc/sysctl.conf

net.ipv4.ip_forward=1