View Full Version : Raspberry Pi IP Address
acastagna
24-11-2016, 06:30
My team is trying to set up vision processing for the first time, and we are going with Java and openCV running on a raspberry Pi. So far we are making good progress, but we have come up on an "annoyance" that we haven't been able to work around. We are doing code development by directly accessing the Pi from a laptop using putty and an ethernet cable.
The problem is we need to have a router in between for this to work, either by ethernet cable or wifi. Is there a way to get this setup to work without a router? I believe the problem is the Pi either doesn't get issued an IP address without the router, or it is getting an address that we cannot find. We have tried using IP Scanner to search for it when there is no router in between with no luck. We also tried setting a static IP but couldn't see the Pi without the router.
Thanks!
If you are plugging the ethernet cord from the Pi directly into the laptop you will likely need to use a crossover ethernet cable instead of the standard ethernet cable (google ethernet crossover). You will certainly need to have static IP addresses set on the Pi (use the network icon on the Rpi or edit /etc/dhcpcd.conf for the newest versions of Raspian) and the laptop will need a static IP as well.
acastagna
24-11-2016, 07:56
Thank you. We'll try the crossover cable and confirm the static IP address.
I think we do have an older operating system because I didn't see a the etc/dhcpcd.conf file. I tried creating one, but that didn't work.
RufflesRidge
24-11-2016, 09:54
If you are plugging the ethernet cord from the Pi directly into the laptop you will likely need to use a crossover ethernet cable instead of the standard ethernet cable (google ethernet crossover).
The Raspberry Pi's NIC supports Automatic MDI/MDI-X so a crossover cable is never necessary. It is very likely your laptop does as well unless it's pretty ancient.
dirtbikerxz
24-11-2016, 10:32
Get this cable from adafruit (https://www.adafruit.com/products/954?gclid=Cj0KEQiAvNrBBRDe3IOwzLn6_O4BEiQAmbK-Dqdgx-lAVEgBkAny27ilefB3c8XrEbX4Xl0UixGgPF0aAmGg8P8HAQ)
It allows you to putty straight into the raspberrypi without even needing to disconnect from your normal wifi. Here is the tutorial on how to use it. (https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview)
billbo911
24-11-2016, 13:18
By default, the Pi is set to DHCP. Thus, it get's it's address from the router. To set a static IP, you will need to modify the etc/network/interfaces file.
Here is what ours looks like.
# interfaces(5) file used by ifup(8) and ifdown(8)
auto eth0
iface eth0 inet static
address 10.20.73.225
netmask 255.255.255.0
gateway 10.20.73.4
auto lo
iface lo inet loopback
You can copy this into your file. Edit it to the addresses you want to use, and comment out the DHCP portions so you can go back to DHCP easily, and then reboot.
It should come up in Static mode and you should be all set.
Have you tried using mdns? By default, the pi should respond to pings on rasperrypi.local I think, even with a self-assigned 169.x.x.x address.
euhlmann
24-11-2016, 14:40
My team is trying to set up vision processing for the first time, and we are going with Java and openCV running on a raspberry Pi. So far we are making good progress, but we have come up on an "annoyance" that we haven't been able to work around. We are doing code development by directly accessing the Pi from a laptop using putty and an ethernet cable.
The problem is we need to have a router in between for this to work, either by ethernet cable or wifi. Is there a way to get this setup to work without a router? I believe the problem is the Pi either doesn't get issued an IP address without the router, or it is getting an address that we cannot find. We have tried using IP Scanner to search for it when there is no router in between with no luck. We also tried setting a static IP but couldn't see the Pi without the router.
Thanks!
I've used Pi 2s and Pi 3s over ethernet directly to my laptop and it's worked.
However there's one more step: Unless you've set the Pi to use a static IP address, you need your computer to run a DHCP server to assign the Pi one. The way I've done that is by using ICS to bridge ethernet to my laptop's wifi connection (since I've also needed the Pi to connect to the internet :) ). ICS runs a DHCP server and uses NAT to connect two interfaces.
On Windows 10, there's probably an easy way to do this through the new Settings app but here's how I've done it:
1. Start icssvc
http://i.imgur.com/4IqhVLw.png
2. In adapter settings on the old control panel, go to properties for your wifi connection > sharing > Check the box > select your ethernet connection
http://i.imgur.com/VOPIAnX.png
Note: if the box is already checked, you'll have to uncheck it, click OK, then open properties and check it again otherwise icssvc won't know about it. This is Windows, remember? :rolleyes:
acastagna
27-11-2016, 19:17
Thanks again to everyone who shared their methods for running the Pi through the laptop.
My goal was to run the Pi through the laptop without a router in between, and have the Pi share the laptop's wifi when the laptop has internet access.
Here's the method that ended up working best for me:
ethernet cable between laptop and pi
ethernet address set to static on both sides
wifi address set to dynamic on both sides
On the laptop use the bridging feature to bridge the ethernet and wifi.
Use WinSCP for file transfer between the two.
I also tried the adafruit cable mentioned by dirtbikerxz. I actually had the cable but didn't realize what it was for. The cable ended up being a little quirky - the driver didn't work, and I had to download this alternate driver http://www.ifamilysoftware.com/news37.html, and the driver executable has to be run every time the cable is used. Also, when using the serial cable the putty window had some issues with command lines wrapping around.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.