LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-26-2009, 09:40 AM   #1
ENVee
LQ Newbie
 
Registered: Jul 2007
Posts: 18

Rep: Reputation: 0
SSH on Linux


Hello,

Here is my problem statement :

I have 2 PCs :
PC1 -> Windows XP with SSH client installed
PC2 -> Linux with OpenSSH installed

Both of them are connected to a common router. The router is in turn connected to a DSL modem. I start an internet connection in my Windows XP desktop. I do not connect my Linux machine to the internet.

PC1(Windows XP)
-------------->Router<------------------PC2 (Linux)


When I type the following in Linux , it does return information about the eth0 interface , but this interface does not have any IP address since the IP address is assigned by my ISP using DHCP :

Code:
bash#> ifconfig
So I believe this is correct.

I do have sshd started on my Linux PC. But since my Linux machine does not have any IP address as it is not connected to the Internet using my ISP , how do I SSH into it from my Windows box which is connected to the internet ? I mean what IP address do I use for connecting from my Windows to Linux box.

I was able to ssh into my Linux box from Windows in the following scenario though , but this is not what I want (unless this is the only option available) :

Windows is not connected to the internet using ISP
Assign static IP address of 192.168.1.1 to Windows box
Assign static IP address of 192.168.1.2 to Windows box
Start sshd daemon on Linux box
ssh from Windows using static IP address of 192.168.1.2

Any help will be greatly appreciated.
 
Old 04-26-2009, 11:05 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,777

Rep: Reputation: 276Reputation: 276Reputation: 276
Do you have DHCP enabled in your router? It usually is by default and should automatically assign an IP to each device attached to it. Your ifconfig output should show that IP address assigned to eth0 by the router, generally in the form of 192.168.1.***. If your eth0 is not getting an IP assigned to it by the router, either the router does not have DHCP running and you'll have to statically assign an IP to it in the range permitted by your router or you have not properly configured eth0.

Please post what distro your are using as network configuration tools vary from one distro to the next. Also post what router you are using because it sounds to me like you do not have dhcp set up on it. FYI, when using a router with a modem, your ISP does not assign an IP to the individual computers connected to the router. Rather the router is assigned an IP by your ISP and and the router assigns IPs to the computers connected to it, generally using DHCP. In that way one internet connection can be shared by all the computers connected to the router. It's called network address translation or NAT for short.
 
Old 04-26-2009, 11:14 AM   #3
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
Windows ----- switch port on router --- LAN --- Router ---- WAN --- DSL Modem ---- ISP
Linux ----- switch port on router ---

The Router's WAN port will initiate a connection to the ISP via the DSL Modem.
The Router's WAN port will be allocated an IP Address.
The Router's WAN port will be running NAT to connect the Private LAN to the Public WAN.

The Windows and Linux host are attached to the LAN.
As kilgoretrout pointed out ... most DSL Router's have a DHCP server that will allocate a Private IP address to the Windows and Linux host.
 
Old 04-26-2009, 11:24 AM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
Way to confusing as to what you want. Lets do one thing at a time.
Connect both machines to the router.
Each get or are assigned and IP
Now can both access the Internet?
They both should access the Internet like discribed.

Now is there a firewall related on either machine?
If so they need to have the port 22 opened or firewall turned off.
Now both should be able to ssh to each other with in the local area network LAN.

For access outside your router in the real world you will need to know the external IP or use a dynamic DNS service to be able to know where your router is at all times.

Now the router needs to be setup to have a port open to allow that connection to be forwarded to and internal lan ip machine and port. Some routers only support say external IP port 22 to and internal IP port 22. Some allow you to select a different port on the external IP to an internal IP with a different port number

Most do this where x.x.x.x is your exteranl IP and y.y.y.y is and internal IP.
x.x.x.x port A to y.y.y.y port A

Some can do x.x.x.x port A to y.y.y.y port B
so this way one can use the same port on each internal machine
Example:
x.x.x.x port 1022 to 192.168.1.1 port 22
x.x.x.x port 1023 to 192.168.1.2 port 22

Can't have the same external port point to the multiple internal IP on the same port.

If you can't do above the set one machine to use a different port for ssh so for windows set it to 23
x.x.x.x port 22 to 192.168.1.1 port 22
x.x.x.x port 23 to 192.168.1.2 port 23

But the first thing to check is firewall settings on each machine.

Brian
 
Old 04-27-2009, 04:03 AM   #5
ENVee
LQ Newbie
 
Registered: Jul 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks to all for your replies!
How do I ensure that my eth0 interface in Linux is setup to automatically get an IP assigned by the router.
kilgoretrout....BTW my windows box does not get an IP address ot 192.168.x.x when connected to the router. It has some address starting with 162.x.x.x. blah blah.
However , when I connect to internet using my ISP details , it does get some IP address specific to the ISP.
 
Old 04-27-2009, 07:09 AM   #6
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,777

Rep: Reputation: 276Reputation: 276Reputation: 276
If a windows box can't get an IP from the router it assigns itself 162.xxx.xxx.xxx by default. Once that happens, the widows box won't be able to communicate with anything through the router because it will be on a different subnet. All this points to you not having DHCP running on your router. Without DHCP running on the router, it can't assign IPs to the connected computers. Again, please post your router model and which distro you are using.

Also, from your posts, it is not clear how your network is presently configured. That's why you are getting answers all over the place. We're just guessing about your setup. Most people configure a router with a broadband modem by having the wire from the modem that normally connects to the computer go to the router WAN port and having the two or more computers connect into the router LAN ports. This setup allows the two computers to share the one internet connection and to communicate with each other through the router. From some of your comments, this does not appear to be how you've setup your router.
 
Old 04-27-2009, 07:44 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 20,522

Rep: Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589Reputation: 3589
Automatic IP address range is 169.254.x.x
As stated we really do not know how your network is setup but it appears that the router is configured in a bridge mode which assigns an ISP IP address to your PC when you log in.

Without knowing the make/model of router we do not know if it has built in capabilities for connection to DSL. If it does then you can reconfigure the router as a gateway. The router will be assigned an IP address from your ISP and your computers will be assigned a local IP address.
 
Old 04-27-2009, 08:17 AM   #8
ENVee
LQ Newbie
 
Registered: Jul 2007
Posts: 18

Original Poster
Rep: Reputation: 0
kilgoretrout and Michael,

Thanks for your reply.My router is an A-Link router. I will try configuring it for DHCP by typing 192.168.0.1 in my browser. The linux distro is a self developed LFS system based on LFS 6.2
 
Old 04-27-2009, 06:01 PM   #9
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
I recommend defining static IPs if you plan to ssh to either machine whether inside lan network or from outside in the real world. This way port forwarding will always goto the same machine no matter which boots first.

Brian
 
Old 05-03-2009, 12:32 AM   #10
ENVee
LQ Newbie
 
Registered: Jul 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Hi Everyone....
Could not look into this issue much because I got busy with some other issues !

Anyway , I used your suggestion about getting DHCP running on my router. When I got my internet connection ADSL router from my ISP , it had been configured with DHCP disabled. I then connected to it using the default address of 192.168.1.1 from my browser and configured it for DHCP.

Everything is working now....Infact , as an added benefit I am even able to get more than one computer connected to the internet using this existing ISP connection. When I did not configure my router for DHCP , I could only connect to the internet from one computer.

Thanks to All!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
kerberized ssh window client can't authenticate to kerberized Linux SSH server celeron Linux - Software 0 04-11-2007 05:36 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:49 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration