Reputation: 1344
I currently have a web server running on my pi, and I am trying to access it from my windows machine. At one point I had the pi physically connected to the same network as my computer was (wifi), but due to circumstances out of my control that is no longer an option. I am at University and have very few options with the network.
Does anyone have any suggestions how I can continue to run the server on my pi, and access it? Can I connect it directly to my PC? Any suggestions would be appreciated. Thanks!
Upvotes: 3
Views: 1455
Reputation: 759
Accessing RPi Using LAN Cable :
Edit your boot/cmdline.txt
file by plugging the memory card into the computer and then editing this file in the boot folder and add ip=192.168.0.200
this line to give it a static IP.
Change the IP of lan adapter in your computer to something like 192.168.0.10 (So that both are on the same network)
After this you can use this ip 192.168.0.200
to ssh to Raspberry Pi using Putty.
Using WiFi to connect to RPi
Edit interfaces file
sudo nano /etc/network/interfaces
Make ‘auto io’ to ‘auto wlan0’. This command makes RPi automatically try to connect to wifi.
Add the following lines or edit if they do not exist:
allowhotplug
wlan0
iface wlan0 inet dhcp
wpaconf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Now edit the **wpa_supplicant** file.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add the following lines:
network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_NETWORK_PASSWORD"
}
Restart the wlan0 interface
use command: sudo ifdown wlan0; sudo ifup wlan0;
After RPi is connected to the network you can use IP scanner to scan for the IP of RPi to ssh to it.
Upvotes: 1
Reputation: 6254
Buy a domain name from http://namecheap.com and activate Dynamic DNS functionality in it and point its A record to your raspberry Pi's IP address (or your home router's address from which you can forward the request to your pi). Read more about Dynamic DNS here https://www.namecheap.com/support/knowledgebase/category.aspx/11/dynamic-dns.
With this method you can access your raspberry pi from anywhere across the world.
This is especially helpful if you do not have a static IP address.
Upvotes: 1
Reputation: 11
You should be able to static an IP on your PC and the Pi withing the same subnet and do it that way. Most network cards should be able to manage that without a crossover cable. IF you are using wifi on your PC there should be no issue with that as you can have a wired connection on the pi and wireless to the outside world.
Upvotes: 1