LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-07-2003, 01:42 PM   #1
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Rep: Reputation: 0
Smile Trying to setup remote logins on small network


Hello -
I am so thankful that these forums exist!

Yes, I guess I am a newbie.

I am trying to setup a few remote logins from my Linux box. When I say remote, I mean via the internet. I want to set it up so that the user can ssh into the machine and do some development work, etc.

My "network" is as follows:

Linux Machine --> ROUTER <--Windows Machine

Each is machine is connected to the router on ethernet cars, and the router is connected to the internet via cable DSL.

I think I have already setup ssh and the ssh daemon correctly, since I can ssh into my own box (sshd is running):

ssh localhost.locadomain

This works fine...

But I can't figure out to allow ssh from outside my little network, e.g., a user in another city using PuTTY and Exceed (or just plain old ssh from an xterm on a SunOS).

BTW, I am running a fairly obscure distro called CPUBuilders Linux, an out-of-the box OS that came bundled with the PC. It seems to work great!

Any help would be greatly appreciated...

Cheers
 
Old 12-07-2003, 01:49 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
Welcome to LQ.

You will need to go into your router setup and forward port 22 to the local IP address of your linux machine.

You may also need to check your firewall settings on hte linux box so they are not blocking port 22:
iptables -nL
 
Old 12-07-2003, 02:52 PM   #3
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
Smile

Thank you for the quick response.

iptables -nL produces the following output (when ran as root):

Code:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
There does not seem to be anything there explicitly blocking port 22.

Quote:
You will need to go into your router setup and forward port 22 to the local IP address of your linux machine.
I don't have the first clue as to how to accomplish this. I am using a Linksys/Cisco router hub. I have looked through all the network settings and the system doesn't seem to know about the router - I just get an IP address assigned by the DSL modem via dhcpcd.

Besides, I would (ideally) like to be able to allow an ssh session to a named mahine, like "myuniqueserver.myuniquedomain" instead of making the user use an IP address. Is this possible, or would that make it a lot more complex?

I know, I know, lots of questions...but all the howtos and tutorials I poured through seem to explain everything excpet what I need to know.

Thanks for your help.

-armedguard
 
Old 12-07-2003, 10:55 PM   #4
zaphodiv
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 30
Read the manual for the router

>"myuniqueserver.myuniquedomain" instead of making the user use an IP address.
You can point a domain name at your internet ip address, places like dyndns.org will give you a name for free and some software that updates the dns if you ip changes.

A DSL connection only gives you one internet ip address, if you want to have several machines behind a NAT router accessible using SSH then you are going to have to use a nonstandard port for all but one of them.
 
Old 12-08-2003, 10:31 AM   #5
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
zaphodiv,
Thanks for the tip. I did indeed read the manual for the router and the configuration is through a web browser (duh - just type in your machine address of 192.168.x.x, etc). This provided me with some good insight as to how this all works, and I am one step closer to getting this to work.

But there does not seem to be a configuration that allows me to route the address of the router through port 22, as mentioned above. As I understand it, my setup to allow ssh to my machine should be:

Internet -> router IP ->port 22->machine IP

Correct?I


Thanks for all the help!
 
Old 12-08-2003, 10:48 AM   #6
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
It should be in advanced under port forwarding. By the way, make sure you change the admin password to something other than the default (and make it difficult to guess!) and make sure as well that the admin server doesn't allow connections from outside your network. By default those Linksys devices are highly insecure.

PS you don't seem to have consulted your product documentation because I have one of the same devices (long since boxed up and now in my garage) and it does document where to find the advanced settings.

Last edited by chort; 12-08-2003 at 10:49 AM.
 
Old 12-08-2003, 01:10 PM   #7
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
It took some folling around with the router settings (which were NOT doccumented, BTW), but I think I got the router using port 22 for ssh. LinkSys has an accute shortage of documnetation and mentions nothing about Linux (only mentions Windows).

Thanks for the tip - I changed my router password and disabled external access immediately. I had no clue it was that insecure!

Here's a real newbie question:
One thing I still don't get. Let's say I wanted to access my machine via ssh through the internet, and its address was 192.168.0.100

Would I ssh to that IP or to the IP of the router (or what)? It wouldn't make sense to ssh to my machine address, since it is local, right?

Please clarify...

Thank you
 
Old 12-09-2003, 12:27 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 58
You are right - you need to ssh to the IP of your router since the servier ip is private.
 
Old 12-09-2003, 01:33 PM   #9
colnago
Member
 
Registered: Nov 2003
Location: Canada
Distribution: ArchLinux
Posts: 324

Rep: Reputation: 30
dslreports.com has a lot of info on routers. If you need more help on yours in the future, they have a hardware specific forum that is very helpful. Security and firmware updates are usually posted there very quickly. There is also a port scan tool that can provide some feedback to your security level (expect to see pport 22 open, as you are forwarding this to your linux box).
 
Old 12-10-2003, 09:53 AM   #10
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
Talking

Thanks everyone for the advice.

I tried to ssh to the router IP and it refused my connection.. I then tried to telnet, and same thing. When I telnet throught port 22, it connects, but then disconnects.

I can ping the router, but that's it. To say the least, it is frustrating. I simply don't know enough about seting up these connections!

Ok, so the next step is figuring out how to make the router IP connect to my local machine IP. It seems like I need to route the IP of the router through my machine (or vice versa, using the route command).

Any suggestions?

Thanks!
 
Old 12-10-2003, 07:44 PM   #11
colnago
Member
 
Registered: Nov 2003
Location: Canada
Distribution: ArchLinux
Posts: 324

Rep: Reputation: 30
Hi,

A lot of newer routers don't use telnet or ssh, you use a browser based interface. To do this, try (in your web browser address bar) http://192.168.0.1

You can look this up in the documentation for the router (online if you don't have it anymore).
 
Old 12-10-2003, 10:25 PM   #12
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
Colnago, et al:
Yes, I tried this and it works. I can use my browser to configure the router, but what I am trying to do is use the router as a gateway to ssh into my linux box, if that is at all possible...
 
Old 12-10-2003, 11:34 PM   #13
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
Can your Linux box access the Internet through the router? If it can, there is no problem with the route on the Linux box.

What you need to do is go into the port forwarding settings and set external port #### to forward to internal port 22 on 192.168.0.100. #### could be anything (even 22), but I don't recommend using a well known port that is likely to be scanned by nmap. Pick something above 1023 (perferably well above 1023) so it's less likely to be discovered.
 
Old 12-11-2003, 10:26 AM   #14
armedguard
LQ Newbie
 
Registered: Dec 2003
Location: Washington D.C., USA
Distribution: CPUBuilders, Mandrake 7.2
Posts: 7

Original Poster
Rep: Reputation: 0
Talking

SUCCESS!!

Thanks guys for all your help.

I think I am beginning to understand the concept of IP routing now! I used the router setup utility to use the router as a gateway to my machine address:

router.ip -> 192.168.1.100, and this is tunneled through port 22. I will consider changing the port, but then this means the sshd will also have to use this port - but that is an excellent suggestion

It feels so good to actually get soemthing to work.

Cheers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enable emacs Backspace on remote logins? jkcunningham Linux - General 18 09-21-2009 03:51 PM
Small Business Server setup timmsy Linux - Enterprise 3 03-11-2005 01:47 PM
Dynamic DNS for remote telnet ssh logins? nadsab Linux - Networking 10 03-27-2004 11:53 AM
Small network setup. HELP..... zaldyd Linux - Networking 0 07-15-2003 12:44 AM
SSH logins and limiting remote users login rights. redgore Linux - Networking 2 07-16-2002 03:22 AM


All times are GMT -5. The time now is 01:38 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration