RHEL vs SLES: netstat -a
April 24, 2007 2:33 PM   Subscribe

Why doesn't "netstat -a" work with forwarded ports on SLES 10x64?

I'm doing some testing work on local port forwarding thru ssh. Everything is going along swimmingly as I develop my tests on my RedHat ES4 box. When I go to run my test against a SLES10 x64 machine, things don't work. I believe I have narrowed down the issue to a problem with "netstat -a" not working as expected on the SLES box.

On the RHEL4 box:

[x@localrh .ssh2]$ ssh -oPort=22 -n -L 3434:dragontail:23 x@dragontail sleep 15 &
[1] 26644
[x@localrh .ssh2]$ Authentication successful.
netstat -a | grep 3434
tcp 0 0 localhost.attachmate.c:3434 *:* LISTEN
tcp 0 0 ip6-localhost:3434 *:* LISTEN
[x@localrh .ssh2]$
[1]+ Done ssh -oPort=22 -n -L 3434:dragontail:23 x@dragontail sleep 15



But on SLES10 x64 box:

x@dragontail:~/.ssh2> ssh -oPort=22 -n -L 3434:localrh:23 x@localrh sleep 15 &
[1] 17294
x@dragontail:~/.ssh2> Authentication successful.
x@dragontail:~/.ssh2> netstat -a | grep 3434
x@dragontail:~/.ssh2>
[1]+ Done ssh -oPort=22 -n -L 3434:localrh:23 x@localrh sleep 15


I've verified that the forwarded ports are available and active on the SLES box, just like on the RHEL box, but I can't figure out why it's not showing up in my netstat. A quick googling for SLES and netstat didn't report any unusual behavior. Am I missing something obvious?
posted by nomisxid to Computers & Internet (7 answers total)
 
Have you tested to make sure that the ports are actually forwarding correctly? There are settings in /etc/ssh/ssh_client that can disable port forwarding.

I'd suggest running the first command without the & sign and seeing if you get any output... the & might be consigning some kind of error into the bitbucket.
posted by Malor at 2:54 PM on April 24, 2007


Sorry, that's /etc/ssh_config, as opposed to /etc/sshd_config. The D configures the local daemon... the no-d version does the local client.
posted by Malor at 2:54 PM on April 24, 2007


Response by poster: I did verify that forwarding is active and working as expected, even when it doesn't show up in the netstat.

There is no additional output from ssh when the command is run in the foreground.

x@dragontail:~/.ssh2> ssh -oPort=22 -n -L 3434:localrh:23 x@localrh sleep 15 &
[1] 18656
x@dragontail:~/.ssh2> Authentication successful.
telnet localhost 3434
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Kernel 2.6.9-42.0.10.EL on an i686
òlogin: x
Password:
Last login: Sat Apr 14 01:52:00 from sugar.attachmate.com
You have new mail.
[x@localrh ~]$
posted by nomisxid at 2:58 PM on April 24, 2007


Response by poster: FYI, I get the same good results on Solaris 9 and 10. I get the same lack-of-results on SLES9-i386.
posted by nomisxid at 3:24 PM on April 24, 2007


Best answer: just an idea, but did you grep for 3434 in netstat -an ?
posted by donut at 3:26 PM on April 24, 2007


Response by poster: How interesting, the "-n" flag did indeed help. Oddly enough though,

x@dragontail:~/.ssh2> netstat -an | grep 3434
tcp 0 0 127.0.0.1:3434 0.0.0.0:* LISTEN
tcp 0 0 ::1:3434 :::* LISTEN
x@dragontail:~/.ssh2> netstat -a | wc -l
317
x@dragontail:~/.ssh2> netstat -an | wc -l
318
posted by nomisxid at 3:38 PM on April 24, 2007


Response by poster: Ah-ha moment. SLES appearently ships with something called "openCM" with a predefined port of 3434 in /etc/services. Much is explained. Thanks all'round for the help.
posted by nomisxid at 3:41 PM on April 24, 2007


« Older Resources and anectdotes related to Feline HIV   |   how to best use MVC architecture in flex 2 Newer »
This thread is closed to new comments.