LinuxQuestions.org
Review your favorite Linux distribution.
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
 
Search this Thread
Old 04-18-2012, 04:43 AM   #1
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Rep: Reputation: 0
Accessing my PC from internet(other PCs)


hellow guys,

I have a question. can I access my personel computer which is connected to internet via Speedigo(ISP). When i try to find my ip from terminal with ifconfig command it returns this ip: 192.168.1.21 and if i google with my ip it returns : 122.102.127.160 which I assume is public ip. But my question is what if i want to connect to my pc from a different one using internet how do i do that .. ?? I mean what is my real ip ?
 
Old 04-18-2012, 05:09 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,527

Rep: Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225
probably you will have a dynamic ip. It means you do not have an ip, but you will get one when you need it from service provider.
to solve your problem you will need a dyndns service, you can find several free provider, like www.no-ip.com and you need to configure your router also. (see http://dnslookup.me/dynamic-dns/ also)
which port do you want to reach?

Last edited by pan64; 04-18-2012 at 05:12 AM.
 
1 members found this post helpful.
Old 04-19-2012, 03:10 AM   #3
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
probably you will have a dynamic ip. It means you do not have an ip, but you will get one when you need it from service provider.
to solve your problem you will need a dyndns service, you can find several free provider, like www.no-ip.com and you need to configure your router also. (see http://dnslookup.me/dynamic-dns/ also)
which port do you want to reach?
I dont have any idea which port i am going to connect .. in fact all I am trying to do is learning. Just trying to figure out how things works. and yes that post is useful ! thanks a lot mate !
 
Old 04-19-2012, 03:11 AM   #4
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,527

Rep: Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225
so you need to define, what do you mean by connect? How do you want to reach that host?
 
Old 04-19-2012, 04:28 AM   #5
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
so you need to define, what do you mean by connect? How do you want to reach that host?
In a way that I can access the given user's files, dirs .. more like login as that user. Am I clear ?? lol I hope I am !!
 
Old 04-19-2012, 04:36 AM   #6
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,527

Rep: Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225
to login you would need ssh, and you need to configure your router to redirect the request from outside to 192.168.1.21.
but we need to know which router you have.
 
Old 04-19-2012, 04:37 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Once you have decided what sort of connection you want too make to your PC (ftp, http, ssh ...) you can find which port that sort of connection uses and configure "port forwarding" on your router so that it forwards all packets arriving from the Internet and addressed to that port to 192.168.1.21.

In this scenario, 192.168.1.21 had better be a fixed IP. If your PC is configured to get an address automatically (from a DHCP server) it might get a different address and your port forwarding would break.

You could forward all packets to your PC but that would be scarily insecure and render your PC very open to attacks from the Internet.
 
Old 04-19-2012, 04:42 AM   #8
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
What device do you have between you and the ISPs modem? Is is Cable or DSL?

You may be behind a NAT router locally. The Internet (WAN) side may have the 122.102.127.160 address. You need to log into your router to make sure.

Do you want to SSH into your home computer from the internet? You didn't explain what you mean by connect. Using ssh you can log in as if you are at the local computer. You can use scp or sftp remotely to transfer files.

If that is the case, you need to configure your home router to redirect port 22 to your computer at 192.168.1.21.
You also need to configure openssh on your home computer. Remotely you would use an ssh client (openssh on Linux, putty on Windows).

(note: some people change the port on the router to a high numbered port. It will reduce the number of brute force attempts. Your router can transfer this traffic and translate the port number to port 22 on your local computer.)
 
Old 04-19-2012, 07:35 AM   #9
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
What device do you have between you and the ISPs modem? Is is Cable or DSL?

You may be behind a NAT router locally. The Internet (WAN) side may have the 122.102.127.160 address. You need to log into your router to make sure.

Do you want to SSH into your home computer from the internet? You didn't explain what you mean by connect. Using ssh you can log in as if you are at the local computer. You can use scp or sftp remotely to transfer files.

If that is the case, you need to configure your home router to redirect port 22 to your computer at 192.168.1.21.
You also need to configure openssh on your home computer. Remotely you would use an ssh client (openssh on Linux, putty on Windows).

(note: some people change the port on the router to a high numbered port. It will reduce the number of brute force attempts. Your router can transfer this traffic and translate the port number to port 22 on your local computer.)
it is a cable. and its not a modem (i mean they have just given me cable). Its just a local company that provides wireless broadband to people. basically they just put a decive on the roof attached with a cable that is forwared to my pc.
 
Old 04-19-2012, 07:37 AM   #10
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Original Poster
Rep: Reputation: 0
and 122.102.127.160 is my public ip .. that keeps changing.
 
Old 04-19-2012, 09:56 AM   #11
jefro
Guru
 
Registered: Mar 2008
Posts: 11,146

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
Your situation is very common. Most people have this. As above the term is dynamic IP. It can change but some people may find theirs stays constant but it is a whim of the ISP.

You have some device like a cable modem. On one side you have a public IP. That is what google reports. To get on the inside of your lan you have either selected or allowed a private IP range.

The term is NAT but really it is a PNAT. Network Address Translation is the means to allow your Public IP to let ports and IP addresses to transverse the two IP ranges and back. Many posts on NAT.

The second issue that was talked about is the ability to "find" your unique public ip address from the outside. As suggested the common method is to get a dynamic DNS. A FQDN is like www.google.com. Everyone on the planet can get to a server that can say what that IP is.

To get to your dynamic IP you need the help of a third party. They provide either free or slight cost way to have a unique name. They also provide some means to track your IP changes. Not all support linux. Some makers or equipment like modems also provide a built in account for some DDNS services. Your modem manual would tell that.

Once you get your DDNS account, you then need to setup a program on the local computer that can track the IP and report back to DDNS service. Then when you go to your computer name (given by ddns company) you can get to your home IP. It may be like bobo.ddns.org or such.

Then you need to configure your modem to forward ports based on the service that you need. Some ISP's block some ports inbound.
 
Old 04-20-2012, 03:11 AM   #12
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Try to point your web browser at "192.168.1.1" or "192.168.0.1". Are you in an appt where several users are on the LAN? Having an local IP of 192.168.1.21 seems to imply that there are other IP addresses assigned. If you are all sharing a router, you may not be able to configure port forwarding.

run "sudo /sbin/ifconfig". Does the NIC have an ethernet connection or ppoe?
 
Old 04-21-2012, 01:21 AM   #13
codename-nos
Member
 
Registered: Apr 2010
Posts: 32

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
Try to point your web browser at "192.168.1.1" or "192.168.0.1". Are you in an appt where several users are on the LAN? Having an local IP of 192.168.1.21 seems to imply that there are other IP addresses assigned. If you are all sharing a router, you may not be able to configure port forwarding.

run "sudo /sbin/ifconfig". Does the NIC have an ethernet connection or ppoe?
ifconfig output
Code:
[nos@Olympians ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.1.21  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::219:21ff:fe1e:90b9  prefixlen 64  scopeid 0x20<link>
        ether 00:19:21:1e:90:b9  txqueuelen 1000  (Ethernet)
        RX packets 2375244  bytes 2445293588 (2.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1974121  bytes 353399601 (337.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  base 0xec00  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 104  bytes 6240 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 104  bytes 6240 (6.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
Old 04-21-2012, 03:29 AM   #14
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Please run "ip route show".

That will show what the default gateway IP address is. If you don't control your gateway router, you won't be able to forward ports.
However, there might be a router located where the cable enters your home. My parents have a wireless router located in the utility room.
 
  


Reply

Tags
ip, telnet


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
allow internet access to router for only few PCs ALInux Linux - Networking 3 09-14-2007 10:37 AM
Local PCs see Internet but not each other neuroman Linux - Networking 14 06-04-2007 01:52 AM
Sharing Internet over two pcs paragkalra Linux - Networking 1 10-11-2006 10:51 AM
why XP and 98 PCs can't join domain for accessing those mapping drives in Linux Samba kkeith Linux - Newbie 1 07-21-2006 01:26 AM
How to share internet connection between two PCs ishti_du Linux - Networking 7 01-24-2006 05:10 AM


All times are GMT -5. The time now is 08:56 AM.

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 Google+: linuxquestions
Open Source Consulting | Domain Registration