I want to set up a tunnel to my home server which will be established right after my machine boots. Using this answer, I've got my
autossh command set up inside a service, which has been set to run at boot. I want the tunnel to work over the internet, and have a dynamic DNS service to accommodate this.
If I run the service manually, the tunnel will connect successfully. The issue occurs when the service is launched automatically after boot. The service starts okay, however the connection to my server is not established since my hostname can't be resolved.
ssh child pid is 1413 ssh: Could not resolve hostname my.host.name: Temporary failure in name resolution ssh exited with error status 255; restarting ssh
My service file is as follows:
[Unit] Description=Creates tunnel to server After=network.target [Service] User=james Environment="AUTOSSH_GATETIME=0" ExecStart=/usr/bin/autossh -M 0 -o "StrictHostKeyChecking=no" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 3030:localhost:22 firstname.lastname@example.org [Install] WantedBy=multi-user.target
Is there any way to get around this?