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 have a static IP and ADSL router linked to a linksys wireless router to which all my machines are connected. I would want to setup SVN on one of machines and provide SSH access which should be accessible by users outside my network. Would this be possible? Even just SVN access through web should be fine. Please let me know what all things should be done to achieve this ? I have Ubuntu VM running in a iMac Leopard machine and another 2 Win 7 32/64 bit machines. I can setup standalone Ubuntu or Win XP on another machine.

Please provide me pointers to port-forwarding if that needs to be done as I have absolutely no clue of how to do it.

Thanks, Raja.

EDIT:

Thanks for the detailed explaination. I tried to setup the ssh first to my mac machine itself instead of VM. Here is currentconfiguration: DSL Router IPv4 Address: 192.168.1.1 Linksys Wireless Router connected to it has IPv4 Address: 192.168.0.1 and same subnet mask 255.255.255.0 as above

Now I have assigned my Mac an IP of 192.168.0.20 and Default Gateway as 192.168.0.1

I enabled SSH in MAC and am able to SSH from another machine locally. ssh raja@192.168.0.20 works.

I have enabled port forwarding on 22 in Linksys router but still I am not able to do ssh raja@publicip Where am I going wrong or what else needs to be done?

share|improve this question

1 Answer 1

If you have a generic setup for SSHD, it's just a matter of telling your Linksys router to forward TCP port 22 to the IP you want access to internally, then from the outside ssh to the static IP, and you'll want to have the machine internally running ssh to have a static IP assigned, not a dynamic (DHCP) address.

Personally, I would change the port to another port not used on your machine, as a nonstandard port makes it more difficult for bots to scan you (And it will happen). But that's up to you. If you use the standard port, you need to be more careful with passwords and usernames, and don't allow root to log in to that port, and you may want to consider installing Denyhosts to block ip's that give an incorrect password 3 times automatically.

Make sure your VM (I assume that's where you are running sshd?) is assigned it's own IP and is using bridged networking so it's not natted twice. That's asking for a world of hurt (nat behind the router, then natted again behind the Leopard machine's VM software). Bridged networking makes the machine appear as if it were another physical machine in your network from the logical view.

You don't necessarily need to set up ssh on the server to a nonstandard port...you could set up a nonstandard port on the router to forward to the internal machine's port 22, if your router supports non-one-to-one mapping (i.e., forward external port 26 to internal port 22 on 192.168.xxx.xxx...), so that only machines outside your network need to use the nonstandard port assignment. But my personal preference is to alter the SSH port on the inside just to tick off bot-scanners.

To sum up...tell your linksys to forward port 22 (or what you choose to use) to your VM's IP. I recommend using a different port, though. Make sure your internal VM machine is using a static, not DHCP, ip address on your internal network, so reboots don't break the forwarding map. Then it's a matter of ssh'ing to your external static IP from an external system to test it. I also recommend using denyhosts if you stick with default port 22 to ban probes. Make sure your VM instance is running bridged, not NAT, networking on the host computer.

share|improve this answer
    
Here is currentconfiguration: DSL Router IPv4 Address: 192.168.1.1 Linksys Wireless Router connected to it has IPv4 Address: 192.168.0.1 and same subnet mask 255.255.255.0 as above Now I have assigned my Mac an IP of 192.168.0.20 and Default Gateway as 192.168.0.1 I enabled SSH in MAC and am able to SSH from another machine locally. ssh raja@192.168.0.20 works. I have enabled port forwarding on 22 in Linksys router but still I am not able to do ssh raja@publicip –  Raja Feb 17 '10 at 7:33
    
You probably will need to test it by using ssh from outside your network, like an internet cafe or library, to properly test conditions for using ssh into your home network, as this will test the connection and routing from an outside point through your provider (they're not blocking ports, are they? Some providers do). You also may want to verify that your ADSL router isn't also filtering things. My DSL router from the provider also does port forwarding, so it's possible that it has settings somewhere to forward the port, in which case you should tell your linksys to act as a switch... –  Bart Silverstrim Feb 17 '10 at 11:02
    
...and not as a router. Check on your ADSL router to see if it has settings for forwarding ports and see if that is adding a layer of complexity to your network. If it is a complete router and not just an ADSL modem, see if you can simplify your network layout by getting an inexpensive switch or turn off your linksys router's routing functions and use it as a simple switch. –  Bart Silverstrim Feb 17 '10 at 11:04
    
And, of course, turn on port forwarding for port 22 TCP on the ADSL router instead of the linksys router (I believe what I used to do to bypass routing on a linksys I had was to just not use the uplink port from a DSL modem to the switch, instead going using just the switch ports.) –  Bart Silverstrim Feb 17 '10 at 11:06

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.