Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to forward port 139 from a Windows machine to my Ubuntu SSH server on a tun interface with the ip address 10.0.0.1.

This is so that I can access the windows shares on the machine on my Ubuntu server, through the reverse tunnel.

I can forward ports to 127.0.0.1, but not to 10.0.0.1.

On windows I am using the Tunnelier ssh client.

On my Ubuntu server, the following message is printed in auth.log:

Received disconnect from 124.109.51.154: 11: Server denied request for client-side server-2-client forwarding on 10.0.0.1:139.

So far i have tried the following settings:

GatewayPorts yes
PermitTunnel yes
AllowTcpForwarding yes 

in the /etc/ssh/sshd_config file, but it did not work.

I set up the tun like this:

sudo tunctl -t loc_0 -u myusername
sudo ifconfig loc_0 inet 10.0.0.1 netmask 255.255.255.0 up

The settings in the Tunneler ssh client should not matter because I can forward port 139 successfully to the Microsoft Loopback Adapter on a Windows machine running the WinSSHD server.

Versions: Windows is XP SP3, Ubuntu is 10.10.


Update:

I tried to forward the port to a number greater than 1024 mentioning the IP address of the tun, and it successfully connected but the forwarding was done on 127.0.0.1 instead of the tun's IP address 10.0.0.1.

So there are two separate problems now, when connecting from the Windows machine:

1) Forwarding on ports less than 1024 is probably being denied. How can we allow that on the server?

2) Forwarding is done only on 127.0.0.1 even if I mention 10.0.0.1 which is the tun's IP address.

Another attempt: I also tried to forward port 22 of a Linux machine to the tun's port 55567. It showed success. But when I tried to ssh into that port using both local addresses, on the Linux machine in its debug display I got the error Connection failed: no route to host when using 127.0.0.1 to connect and simply Connection refused when using the tun's IP address.

So the tun is not getting the forwarded port no matter we connect from a Windows client or a Linux client.

share|improve this question
    
Which version of Windows you have? They made bad changes after XP if I remember correctly. –  Eduardo Ivanec Apr 16 '11 at 0:42
    
@Eduardo: I've mentioned the versions of the OS's. Do you have any idea about configuring a tun device for such a purpose, because I can forward the port successfully onto an ssh server running on Windows. –  sarshad Apr 16 '11 at 19:14
    
SSH tunnels and tun interfaces have nothing to do with each other. –  Chris S Apr 16 '11 at 19:16
    
@Chris S: I want to forward the port to the tun's IP address, instead of 127.0.0.1. How can I do that? Or is it just not possible on Linux? –  sarshad Apr 16 '11 at 19:19
    
I understand now. My apologies. Try AllowTcpForwarding yes –  Chris S Apr 16 '11 at 19:23

2 Answers 2

Regarding <1024 you can only do that by using root for the ssh tunnel:

http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-ssh-beyondshell-tcpip.html

Note

Setting up port forwarding to listen on ports below 1024 requires root level access.

Regarding 127.0.0.1 you probably need to use '-g' in your ssh setup:

 -g      Allows remote hosts to connect to local forwarded ports.
share|improve this answer

What´s about this:

sudo ifconfig eth0:0 10.0.0.1 up
sudo ssh -g -L 139:10.0.0.1:139 user@sambahost
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.