LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Accessing my PC from internet(other PCs) (https://www.linuxquestions.org/questions/linux-networking-3/accessing-my-pc-from-internet-other-pcs-940418/)

codename-nos 04-18-2012 04:43 AM

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 ?

pan64 04-18-2012 05:09 AM

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?

codename-nos 04-19-2012 03:10 AM

Quote:

Originally Posted by pan64 (Post 4655983)
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 !

pan64 04-19-2012 03:11 AM

so you need to define, what do you mean by connect? How do you want to reach that host?

codename-nos 04-19-2012 04:28 AM

Quote:

Originally Posted by pan64 (Post 4656976)
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 !!

pan64 04-19-2012 04:36 AM

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.

catkin 04-19-2012 04:37 AM

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.

jschiwal 04-19-2012 04:42 AM

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.)

codename-nos 04-19-2012 07:35 AM

Quote:

Originally Posted by jschiwal (Post 4657139)
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.

codename-nos 04-19-2012 07:37 AM

and 122.102.127.160 is my public ip .. that keeps changing.

jefro 04-19-2012 09:56 AM

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.

jschiwal 04-20-2012 03:11 AM

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?

codename-nos 04-21-2012 01:21 AM

Quote:

Originally Posted by jschiwal (Post 4658110)
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


jschiwal 04-21-2012 03:29 AM

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.


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