User avatar
RDK
Posts: 262
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Connecting a Pi to a PC

Mon Jan 16, 2017 2:29 pm

I've tried to search on this topic but was not successful. My question is can I connect my Pi directly to a PC or laptop (Ethernet or USB) and then interact with it using PUTTY or some other program?

I know that if the Pi is on my network with an IP address I can get to it using PUTTY. But, what if I'm travelling (car, train or plane) and want to do something on the Pi, but don't have an available network?

Just curious.....RDK

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Connecting a Pi to a PC

Mon Jan 16, 2017 2:52 pm

Which model of Raspberry do you have?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Mon Jan 16, 2017 3:04 pm

A working method is to set a static IP on the Pi to 169.254.64.64 and then you can just use that address if you plug it into a PC ethernet port as your PC will allocate itself an address in the 169.254 range

There is a chicken and egg situation over editing the Pi address (especially when going back to DHCP) but if you wireless DHCP at home and static ethernet away then no problem :)

Another common method is to turn your phone (if its a 'droid) into a hotspot with same name/password as your home setup) and then just use that on the road

User avatar
RDK
Posts: 262
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Connecting a Pi to a PC

Tue Jan 17, 2017 5:57 am

Dougie....It could be either a Raspberry Pi B+ or a Raspberry Pi v2, and the OS could be either Wheezy or Jessie. I have those combinations. As I said this is more of a curiosity than a real need....RDK

Matt. Interesting, I'll have to give these a try.....RDK

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 12:47 am

B+ and 2B are easy.

Connect them with a cat5 cable.

Add ip=169.254.3.14 to the end of /boot/cmdline.txt
Reboot the RPi and use PuTTY to connect to 169.254.3.14
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 7:02 am

Add ip=169.254.3.14 to the end of /boot/cmdline.txt
I thought that feature was removed ages ago?????

Does it still work?

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 7:56 pm

mattmiller wrote:
Add ip=169.254.3.14 to the end of /boot/cmdline.txt
I thought that feature was removed ages ago?????

Does it still work?
Yes. It's part of the kernel NFS root file system support. The only thing to note is that if the eth0 interface isn't connected to anything you WILL get a two minute boot delay.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 8:31 pm

Well - thats good news :)

Does it just get applied to eth0?

Not wlan0 or PiZero using USB networking?

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 8:57 pm

I've only ever done it with eth0.

http://fscked.org/writings/clusters/nfsroot.txt says you can use other devices.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Wed Jan 18, 2017 9:03 pm

:-)
I'll have to have a play with the parameters and see if we are lucky for PiZero USB peer-peer networking :)

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 2:06 pm

@dougie
Tried
ip=192.168.0.224:::::wlan0

but no joy
Not really surprising I suppose as prob too early in the initialisation sequence for wlan0 to be enabled at that point

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 3:24 pm

Looks like I'll need to do an experiment with my A+ (my Zero is busy doing a long term project).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
procount
Posts: 1782
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 3:45 pm

My usual technique to connect my RPi over ethernet to my PC is to simply run TFTPD32 http://tftpd32.jounin.net/tftpd32_download.html on my laptop as a DHCP server.
That way I don't have to modify my Pi network configuration - I just plug it in and the PC assigns it an IP address.
I use a separate USB-Ethernet dongle on my PC so that I can assign a static IP address to it and not interfere with my PC's own client dhcp connection to other networks.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 4:27 pm

My usual technique to connect my RPi over ethernet to my PC is to simply run TFTPD32 http://tftpd32.jounin.net/tftpd32_download.html on my laptop as a DHCP server.
Nice find :)

How do you config it to act as DHCP?
And how do you then know what IP it hands out?

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 4:34 pm

My usual technique to connect my RPi over ethernet to my PC is to simply run TFTPD32
Which OS do you run on your "laptop" ?
If this post appears in the wrong forums category, my apologies.

User avatar
procount
Posts: 1782
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Connecting a Pi to a PC

Wed Jan 25, 2017 4:37 pm

Pretty simple - go into settings, select DHCP and enter the appropriate values for your DHCP pool, e,g, Pool start address, size of pool, lease time, router info etc. I just bind it to the usb ethernet dongle so that it doesn't answer on any other interface.

It shows you all the IP addresses that it hands out to what MAC addresses, the time they were allocated and when the renewal time is,

It can also act as a syslog server, and a tftp server (of course) for bootp etc.(if you want to use PXE on a Pi3, for example)

I have used it on WinXP and Win7.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
RDK
Posts: 262
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Connecting a Pi to a PC

Fri Jan 27, 2017 10:36 pm

@matmiller...
Another common method is to turn your phone (if its a 'droid) into a hotspot with same name/password as your home setup) and then just use that on the road
That works and I pretty slick.

I'm working on the option to connect it directly to the laptop with an Ethernet cable. May get to it this weekend. Will a normal Ethernet cable work or does it need to be a cross-over cable. This experiment will be a B+ with Jessie or a Pi V2 with Jessie.....RDK

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Fri Jan 27, 2017 10:38 pm

Will a normal Ethernet cable work
Yep Pi do auto-xover

User avatar
RDK
Posts: 262
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Connecting a Pi to a PC

Fri Feb 10, 2017 12:33 am

Folks....
A working method is to set a static IP on the Pi to 169.254.64.64 and then you can just use that address if you plug it into a PC Ethernet port as your PC will allocate itself an address in the 169.254 range
Over the past few days I've experimented with just plugging eth0 on a Pi V2 Jessie into the Ethernet port on my Win 10 laptop. Using a monitor, of course, to monitor the boot up. The laptop consistently assigns itself 169.254.54.112 and the Pi 169.254.167.89. Using Putty I can connect to the Pi.

Thus, this seems to work well as did using the Hotspot on my cell phone.....RDK

ps....Don't have a Pi running Wheezy with me, but I will try that later....

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Connecting a Pi to a PC

Fri Feb 10, 2017 7:03 am

The laptop consistently assigns itself 169.254.54.112 and the Pi 169.254.167.89.
mm- interesting.
I've never bothered checking this as I'd assumed they were just random
I wonder if computers use some algorithim based on MAC addresses of the interfaces?

tweak42
Posts: 503
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: Connecting a Pi to a PC

Fri Feb 10, 2017 9:08 am

mattmiller wrote:
The laptop consistently assigns itself 169.254.54.112 and the Pi 169.254.167.89.
mm- interesting.
I've never bothered checking this as I'd assumed they were just random
I wonder if computers use some algorithim based on MAC addresses of the interfaces?
If there is it's probably in RFC 3927.
https://en.wikipedia.org/wiki/Link-local_address


RDK wrote:I've tried to search on this topic but was not successful. My question is can I connect my Pi directly to a PC or laptop (Ethernet or USB) and then interact with it using PUTTY or some other program?

I know that if the Pi is on my network with an IP address I can get to it using PUTTY. But, what if I'm travelling (car, train or plane) and want to do something on the Pi, but don't have an available network?

Just curious.....RDK
You could create a static IP entry on the SD card and Windows interface or you could just let both devices auto assign 169.254.x.x address.
Then to find a headless Pi's address from a Windows computer, you will need zeroconf installed to resolve raspberrypi.local to that address.
Some popular applications include it or you can install Bonjour.
https://learn.adafruit.com/bonjour-zero ... x/overview
After booting up and letting both devices find each other, you should be able to ssh and ping raspberrypi.local

Additionally, if you happen to be connected to the internet via wifi, you can also bridge your wifi to ethernet connections to share the internet to the attached Pi.
http://www.windowscentral.com/how-set-a ... windows-10

User avatar
RDK
Posts: 262
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Connecting a Pi to a PC

Fri Feb 10, 2017 3:07 pm

Thanks. You guy are full of good and interesting ideas. I'll let you know how I make out with a Wheezy build when I get access to one....RDK

Return to “Beginners”