1
0
I usually do this:
scp something user@ip
But, that's because my other server has an IP.
What is the IP of my laptop? (What if I am behind a wireless router?) How do I scp into my laptop?
1
0
I usually do this:
scp something user@ip
But, that's because my other server has an IP.
What is the IP of my laptop? (What if I am behind a wireless router?) How do I scp into my laptop?
8
Your wireless router creates a private network for your laptop and all your other wireless devices to share a single IP address. The IP your ISP gives you might change from time to time but for the most part it doesn't change too much.
When your router gets a request from the internet to port 22, it blocks it because the router doesn't know what computer to send the request to. But if you tell it to, it can forward the port to a specific computer, i.e. your laptop.
So you can usually access your routers settings by pointing your browser to 192.168.0.1 (or 1.1) and look for a section with the words port forwarding in it. Tell it to forward port 22 to your laptop's ip address. (You can get the address via ifconfig).
Use a website like whatismyip.com to find out the public-facing address that the ISP gives you and then use the public IP address to connect to your laptop via SSH.
If you only want a temporary connection you can use your web server to bounce connections to your local computer by using openssh like this:
ssh server-user@server-ip -R2222:localhost:22
As long as that connection (from your laptop to your server) is open, then you can connect to your laptop with:
ssh laptop-user@server-ip -p 2222
4
The wireless router you are behind is likely performing Network Address Translation. That means that your laptop is a non-routable, internal IP like 192.168.1.3
. You can see this by running ifconfig
on your laptop, assuming you're running Linux as indicated by your tags.
Your router has both an internal IP, on the NAT network, and an external IP visible by the greater Internet. In order to connect using ssh to your laptop on port 22 from the Internet, you'll need to set up your router to forward traffic to port 22 to your laptop's internal IP. That can be done by using the web interface for your router's settings, typically by opening your browser to something like http://192.168.1.1, http://192.168.0.1, etc, depending on your internal network settings. Then, you would simply connect to your router's external IP using ssh/scp from an outside machine, and the traffic would be forwarded to your laptop.
2
To find out the ip of your laptop, launch ifconfig
from a terminal application (technically it's a command you're supposed to type at a shell command prompt).
To find out what IP you have online,
This, however, does not guarantee that you can do scp from a remote site into your laptop. As a matter of fact,
Things might be more complicated than that. Next time please state clearly what your OS is, what you need to do, provide examples, and if possible detail which steps you did and why it wasn't working.
1sounds like a superuser question – warren – 2009-11-30T13:52:13.950
1Now I can't stop singing "My bratwurst has a first name, it's F-R-I-T-Z..." – womble – 2009-11-30T21:00:52.920