Subject: telnet -4 command switches on IPv4 mode for other apps
To: None <netbsd-users@netbsd.org>
From: Alasdair <alasdair@iprimus.com.au>
List: netbsd-users
Date: 02/08/2007 22:27:05
Hi,

I have been struggling for sometime to send email from NetBSD 3.0.1 with msmtp via mutt. I finally worked out(?) that it is a problem with a router that advertises IPv6 but does not handle it. I had this problem with fetching packages via FTP using pkgsrc, which was fixed by forcing FTP to use IPv4. 
I tried to connect via telnet to my isp failed. Tried again using -4 option succeeded.See the following code

telnet smtp.iprimus.com.au 25
Trying 1.0.0.0...
telnet: Unable to connect to remote host: Connection timed out
$ telnet -4 smtp.iprimus.com.au 25
Trying 202.138.53.12...
Connected to smtp.iprimus.com.au.
Escape character is '^]'.
220 smtp06.syd.iprimus.net.au ESMTP
Connection closed by foreign host.

Then the strangeness begins, I find that I can now connect to my isp via Telnet without invoking the -4 option see code below. 


$ telnet smtp.iprimus.com.au 25
Trying 202.138.53.12...
Connected to smtp.iprimus.com.au.
Escape character is '^]'.
220 smtp06.syd.iprimus.net.au ESMTP
Connection closed by foreign host.

Also afer invoking telnet -4 msmtp is able to connect to my isp and send messages. This only lasts for a short while. I have tried all sorts of things to deliberately get it to revert to failing to send, opening mutt in another xterm, trying to connect via telnet without the -4 option, the only thing that makes it revert s time as far as I can tell. 

It seems that using telnet -4 is opening sort of gateway that then shuts after some time. 

Is it forcing  msmtp to use IPv4? There does not seem to be any way of doing 
that that I can see from the msmtp man pages.

Also how do I enable this situation (being able to send mail using msmtp) permanently ? I can see that it could be done by getting mutt to invoke a script that would mimic the actions I just described, but it would be clunky, I don't have that skill level yet and it would "timeout" after a while. Is there a conf file I could edit or some ENV to change or something of that nature?

Regards,

Alasdair


$