1

well I have been following every rule out there on Forwarding.

I currently have 2 computers, lets call it Computer DOG and Computer CAT.

I can ssh into DOG from outside my network perfectly. I went on my router and added a new service to forward to 192.168.1.10 using port 22. So I am able to ssh using my public IP address from outside the network for dog. as ssh [email protected] -l dog.

now for Cat, since port 22 is used up, I am trying to open port 2222. So, when I try to ssh [email protected] -p 2222 I get connection timed out or connection refused. I also edited my /etc/ssh/sshd_conf file and added Port 2222 on it. On my router, I also added 192.168.1.7, which is cat add added port 2222. Funny thing is, I can SSH CAT within the network normal by typing "ssh [email protected]" and goes right in, in my local network.

is there a firewall for ubuntu that I need to change or soemthing? Or something with my MODEM? or what is it that I am doing wrong?

1 Answer 1

1

You're misunderstanding port forwarding.

You got DOG set correctly... that is External IP-port 22 -> DOG internal IP port 22

For CAT what you want is External IP-port 2222 -> CAT internal IP port 22

You don't want to change any local machine, you just want the router to take requests for 2222 and send them to the correct IP/port combo, which is the internal IP for CAT and its SSH service is running on port 22.

For example this is how I would set it up on my router (your screen will probably look slightly different).

Router setup

What the above directions say to the router: Take traffic coming from the internet on port 2222 and route it to port 22 of CAT on the local network at local ip address 192.168.1.5.

Another hint: If your router has DHCP turned on, find the DHCP reservations table in your router and add entries to it so that CAT and DOG will always be given the same IP address. DHCP assigns your local IP addresses, and it simply assigns the next available when a device comes online and says "I need an IP". However when you are forwarding ports, you want those local devices to always get the same IP. If they didn't, then one day DOG might have CAT's IP and vice versa. Setting the DHCP reservation would make sure that DOG and CAT always get the same IP.

2
  • Ok this makes a little sense now. So, I am not even supposed to touch my CAT configuration? I just have to add 2222, to my router start and end ports? How do I exactly tell my router to take in requests from 2222? Commented Aug 15, 2014 at 11:46
  • @user2805313 I added a lot to the answer via edit. that should answer your questions. I'm not sure what you mean with the last question, but if it means port 2222 is normally closed, how do I open it? The answer to that is setting port forwarding will open port 2222.
    – Tyson
    Commented Aug 15, 2014 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .