Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is where I spent much time to know why I'm unable to connect to my local box from my own remote server (VPS); seems to be my local box's IP address issue. To begin with, let me 1st tell how I operate in Internet. I connect my laptop with my cellphone Nokia N73 having Vodafone sim card. This way (dial-up) my laptop is connected to Internet. Regarding the remote server (VPS), I purchased it from http://lvpshosting.com/ They provide 100 Mb/s net speed.

I have remote's IP address. I ssh it and connect. Now, to connect from there to my local, I need my local IP add. So, checked my IP executing ifconfig on my local box. Please see the output below:

ravbholua@ravbholua-Aspire-5315:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1b:38:d0:45:ea  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:18 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:493 errors:0 dropped:0 overruns:0 frame:0
          TX packets:493 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:85372 (85.3 KB)  TX bytes:85372 (85.3 KB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.224.108.37  P-t-P:10.6.6.6  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:4848 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5375 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:2352345 (2.3 MB)  TX bytes:698847 (698.8 KB)

ravbholua@ravbholua-Aspire-5315:~$

From here, I suppose it to be 10.224.108.37 But when using this from remote, it doesn't work to connect to my local box.

I have tried using the following for my local IP address.

http://www.ipchicken.com/

http://whatismyip.org/

These 2 links gave IP address but none worked. As someone told that the address given by these 2 links are of my cell phone and not of my laptop. Also when I connect to my remote from local via ssh, then when I log in to my remote, the remote server messages as seen below:

ravbholua@ravbholua-Aspire-5315:~$ ssh  rs
ravbholua@rs's password: 
Welcome to Ubuntu 13.04 (GNU/Linux 2.6.32-042stab076.5 i686)

 * Documentation:  https://help.ubuntu.com/

No mail.
Last login: Tue Sep 10 08:04:49 2013 from 123.63.112.140
ravbholua@ravi:~$

This IP address as mentioned above is similar to what I get from the 2 links above. (and is not the one given by command ifconfig .)

So, one told me that the remote server displays the IP of the cell phone which is acting as a router and your local machine is not reachable. But I couldn't get any further solution on how my local box would be reached.

Please have a note here that I had posted this query on a different site (mentioned below) but couldn't get solution. It would be very useful if one please have a look at that thread of mine in that forum:

http://www.linuxquestions.org/questions/linux-networking-3/not-able-to-do-password-free-access-to-remote-machine-4175475825/

Much of my other related tasks are pending due to this issue. I am too hopeful from this site as a few other earlier unsolved queries of mine got solved in this site.

share|improve this question
    
Why are you connecting back with SSH? is there something you need to do that you can't with your existing outbound connection? –  Yuugian Sep 20 '13 at 12:44
    
Not necessarily, I am connecting back with ssh but yes my local IP is reqd. for many needs. Take for example, For making X-client running on remote to display on my local machine, I need my local IP address. Also, I w'd need to connect to my local machine when I am out in from of a different machine. –  Ravi Sep 20 '13 at 13:06
    
You don't need your IP for that, just use ssh -Y to connect to the remote and that should allow you to open remote GUI apps that display locally. –  terdon Sep 20 '13 at 16:42
    
related: serverfault.com/questions/521200/… –  strugee Sep 20 '13 at 20:02
add comment

2 Answers 2

First of all, you don't need to connect to your machine in order to display remote programs locally. In fact, it's harder to do it that way. In order to log into a remote server and run a graphical program and see its GUI on your local machine, you will need to activate ssh X forwarding which is done by either the -X or -Y options of ssh:

 -X      Enables X11 forwarding.  This can also be spec‐
         ified on a per-host basis in a configuration
         file.

         X11 forwarding should be enabled with caution.
         Users with the ability to bypass file permis‐
         sions on the remote host (for the user's X
         authorization database) can access the local
         X11 display through the forwarded connection.
         An attacker may then be able to perform activi‐
         ties such as keystroke monitoring.

         For this reason, X11 forwarding is subjected to
         X11 SECURITY extension restrictions by default.
         Please refer to the ssh -Y option and the
         ForwardX11Trusted directive in ssh_config(5)
         for more information.

 -Y      Enables trusted X11 forwarding.  Trusted X11
         forwardings are not subjected to the X11 SECU‐
         RITY extension controls.

So, simply connect to the remote server and rn your application (using xclock as an example`):

 user@local$ ssh -Y user@remote
user@remote$ xclock

That should cause a clock to appear on your local computer screen.


Now, the rest of your problems are probably due to your using your phone as a modem. The IP you get from whatismyip.com is the IP of your telephone, not of your computer. Your telephone is not configured to allow ssh access so you can't connect to it.

Now, I've never connected through a phone but if I understand your ifconfig output correctly, your phone's IP is 10.224.108.37 and your computer's local IP is 10.6.6.6. This means that in order to connect to your computer you would have to somehow configure your phone to forward incoming connections on the ssh port (usually 22) to your IP. I have no idea if this is possible, have a look at your phone's manual.

An alternative would be to set up an ssh tunnel that goes through your phone. This will only be possible if you have ssh access to the phone though and that does not seem to be the case.

Anyway, the basic message here is that you almost certainly don't need to connect back to your computer, this looks like a classic XY problem. So, put down the chocolate covered banana... :)

share|improve this answer
add comment

Because you are using your cell phone as a dial-up modem instead of using a cellular data plan: the address would not be the one from your phone because it is just acting as a modem.

The IP listed as Last login: Tue Sep 10 08:04:49 2013 from 123.63.112.140 would be similar to your current IP but not necessarrally the same.
Use the last command to find your current login, it gives results like yuugian pts/0 0.0.0.0 Fri Sep 20 08:32 still logged in that will show the one your server can currently see which may match the one from whatismyip.org or may not. The 10.?.?.? address you get from ifstat is the one for your ISP's internal network that your sever won't be able to see.

The real problem you are going to have is "Does my ISP allow port 22 inbound?" You may have to contact them to find that information. I suspect not but you can test it by trying to telnet $MYIP 22 and see if it connects.

If that does not work, you may have to consider an alternate method of connecting.

Yuugian

share|improve this answer
    
last gave the output as :ravbholu pts/2 :0.0 Fri Sep 20 18:38 still logged in ravbholu pts/1 :0.0 Fri Sep 20 10:40 still logged in ravbholu pts/0 :0.0 Fri Sep 20 10:27 still logged in reboot system boot 3.8.0-30-generic Fri Sep 20 10:24 - 18:38 (08:13) ravbholu pts/0 :0.0 Thu Sep 19 19:47 - 20:41 (00:53) –  Ravi Sep 20 '13 at 13:12
    
the :0.0 looks like you are logging in from a local machine, I assume you are trying in on the laptop. I meant that you should run it on the remote machine once you have connected. And you will only need the one listed as still logged in –  Yuugian Sep 20 '13 at 15:38
add comment

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.