adventures in vps

Share

if youre using hetzner, and using docker, you might need to do this if youre having some odd network problems.

i wasnt able to connect to tls connections, email, websites, nothing. but i could ping and nslookup. it all seemed ok.

openssl s_client -starttls smtp -crlf -connect smtp.mailgun.org:587

this would just show CONNECTED and then stop, where normally you would see the output of the certificate for the connection

the fix was after running ip a and seeing the MTU for the network interface and the docker interface were different. the interface on the vps was 1450 and docker was 1500

to fix this in the docker compose file i set this value

networks:
  container-network:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: br-bridge
      com.docker.network.driver.mtu: 1450

the key point there was the com.docker.network.drive.mtu: 1450, this should match the vps server's network mtu. the rest of the values may differ depending on how you have the docker network set up.

NOW - how do you automate that? With sed of course!

sed -i '/com.docker.network.bridge.name: br-mailcow/a\      com.docker.network.driver.mtu: 1450\' ./test