Internet Woes: Delivering the mail in spite of the weather

My ADSL connection is having difficulties at home ... one of the few services I really care about is getting email ... and without a working externally accessible IP address it is hard to deliver mail to your mail server. Many large telcos’ NAT mechanisms make it extremely difficult to connect to services behind their 3G dongles; fortunately with the help of ssh, inetd and socket a solution can be temporarily cobbled together.
The trick to this solution is to set up a local socket on a machine that you can ssh to from the machine that you can’t expose the SMTP port on. We will use port 10000 to avoid an SSH warning. From the mail server

   ssh -4 -R 10000:127.0.0.1:25 user@host-you-manage.example.com



On the accessible external host create an entry in inetd.conf

   smtp stream tcp nowait nobody /usr/local/bin/socket socket localhost 10000



This line connects external connection attempts to localhost port 10000 which allows access to the mail server’s port 25.

Don’t forget to allow connection to the smtp port in the firewall.

Now all I have to do is wait for Internode to find the fault - though I am leaning towards a tech stealing the line from my Naked DSL Service - if this is the issue I hope they will give the line back.