LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Direct connection via ethernet (https://www.linuxquestions.org/questions/linux-newbie-8/direct-connection-via-ethernet-4175530860/)

mantamar 01-13-2015 03:43 AM

Direct connection via ethernet
 
Hi I am not a complete Linux newbie, but I have a challenge that is new to me.

I am wanting to be able to connect to a linux box (Raspberry Pi running Debian) via ssh directly from a single computer. I want to be able to plug in a ethernet cable from a laptop to the Raspberry Pi so that I can configure it via ssh or a webpage.

I have had a few pieces of hardware, routers, printers etc that allow this sort of connection for configuration, I just would like to know how it is done.

My question is how do I set up the /etc/interfaces file to allow the Raspberry Pi to be found by the laptop.

Once configured I would want the Raspberry Pi to obtain its IP address via DHCP when connected to a network.

Any suggestions, ideas would be appreciated.

pan64 01-13-2015 03:49 AM

I would suggest you to plug both your laptop and pi into the router, switch on DHCP and DNS on the router. Probably you need to modify /etc/interfaces to use dhcp.

average_user 01-13-2015 05:13 AM

To connect your laptop to RP directly using an Ethernet cable do this:

On your laptop:

Code:

sudo ip ad add 10.0.0.10/24 dev eth0
On your RP:

Code:

sudo ip ad add 10.0.0.20/24 dev eth0
Test connection to RP from your laptop:

Code:

ping 10.0.0.20
These instructions are from here.

If you want your RP to receive IP address automatically you have to connect it a device that has a DHCP server running.

rtmistler 01-13-2015 07:10 AM

The Pi should come up in Debian and DHCP for an address unless you've modified the network settings from their defaults. However you'll need to add a keyboard and monitor so that you can determine what the IP address is so you can ssh to it from another system.

mantamar 01-14-2015 11:00 AM

What I am actually trying to do is build a headless box based on a raspberry pi.

To allow the user to make configuration changes they will access a HTML GUI that is accessed from a web browser on another computer.

I have partially solved the problem by using mDNS / avahi . This allows the user to access the box using a local URL e.g. raspberrypi.local . However this is still reliant on the box being plugged into a network with a DHCP server running.

What I am wanting to do is allow the user to just plug in an ethernet cable between the box and their laptop to access the GUI configuration page.

jefro 01-14-2015 07:26 PM

If you don't want to set static IP and can't easily use dhcp then you can just tell your local computer to add in static arp. Use mac address of the pi to a current unused subnet ip. Then you access the pi from that ip. Be sure they know how to delete the static arp entry.

Could go more wild and fool with naming.

It is easy enough to make a batch or script that will add and subtract arp entry.


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