2

I am trying to SSH into my Raspberry Pi 3 Model B V1.2 from my laptop running CentOS7. I have connected them together via Ethernet cable but the laptop is unable to identify Raspi. So i tried running the following command provided by a user in a similar question on StackExchange:

$cat /proc/net/arp
IP address       HW type     Flags       HW address            Mask     Device

Also i tried scanning using nmap using this command found while searching StackExchange:

$nmap 192.168.1.1-20
Starting Nmap 7.70 ( https://nmap.org ) at XXXX-XX-XX XX:XX XXX
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap done: 20 IP addresses (0 hosts up) scanned in 0.04 seconds

Constraints:

  • I don't have an external display with HDMI input port.
  • I don't have a router.

Edit: So far i have tried two things.

  • I tried assigning IP address to my Raspi as well to my Ethernet port manually as told by a user in one of the answers.

    $ssh 192.168.1.10
    ssh: connect to host 192.168.1.10 port 22: Connection refused

  • I tried installing dhcp server on my laptop as told by another user in the answers.

    systemctl start dhcpd
    Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details.

  • 1
    you should edit the question and add as an update what you did so far (mostly in the answer's comments), so that by just looking at the question alone people will be up to date to your problem – A.B Mar 20 at 18:56
0

I think you might be searching for something that doesn't exist. Your PI probably doesn't have an IP address.

These days it might actually be easier to configure your Raspberry PI's internal WIFI to connect and find it that way. If you want to do this with a direct cable then you will need to consider the following:

Your first problem might be the cable. It used to be a problem that Ethernet devices couldn't detect when they were wired PC to PC and needed a special "crossover cable" to achieve this. Switches (and routers) are wired in reverse meaning you don't need the cross over with a switch or router. Modern PCs can often auto-detect but this is not guaranteed.

Secondly without a router involved there will be no DHCP server to assign IP addresses. I believe windows would just pick an IP, but I don't believe Linux and your PI will.

Fortunately you can statically assign an IP address on both your laptop and your PI. The simplest way on your pi might be to edit /etc/network/interfaces:

auto eth0
iface eth0 inet static
    address 10.0.0.10
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255

I don't know centos but... This link suggests ... /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=enp3s0
ONBOOT=yes
IPADDR=10.0.0.20
NETMASK=255.255.255.0

Remember to check your LAN device name on CentOS. You should be able to do this by typing at the command line ip address. This will list a number of devices:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 11:21:07:02:2f:10 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 83996sec preferred_lft 83996sec

In the above my network device name is enp0s3.

  • How can i access Raspi to edit etc/network/interfaces if i cannot SSH into it. Also what do you mean by LAN device name? – lycanthrope10100 Mar 20 at 11:56
  • How did you install the OS on the PI? If you have a linux laptop, just pop the SD card out and plug it into your laptop. – Philip Couling Mar 20 at 11:59
  • Oh ok, so i have to change line no.3 address 10.0.0.10 to a IP of my choice and in /etc/sysconfig/network-scripts/ifcfg-eth0 line no.3 to same IP address i chose for my Raspi. Please can you confirm? – lycanthrope10100 Mar 20 at 12:03
  • Yes, but remember to keep both devices on the same subnet. That is first three numbers the same on both devices, last number different when the subnet mask is 255.255.255.0. 10.10.10.x is a good subnet to use as long as your LAN / WIFI is not on the same one. – Philip Couling Mar 20 at 12:04
  • Also will the line no.4 remain unchanged? – lycanthrope10100 Mar 20 at 12:06
0

I am trying to SSH into my Raspberry Pi 3 Model B V1.2 from my laptop running CentOS7. I have connected them together via Ethernet cable but the laptop is unable to identify Raspi... Please suggest a method to SSH into Raspi from my laptop

So SSH is a protocol. That is a method of communication, which happens on top of the Ethernet connection... which uses TCP/IP. In other words, it sounds like your Rasb_Pi is not networking properly, and that is the problem first and foremost.

my recommedation:

  1. on rasbery pi you have no display, so i assume it comes preconfigured and is using DHCP... which is ok. What that means is when network cable is plugged in to it, it is looking for a DHCP server to get itself an IP address.
  2. to solve problem of needing a dhcp server u can plug things into a router (your home router given to you by your Internet service Provider) which will provide DHCP...
  3. or if it's just the laptop and rasb_pi connected together directly (which is perfectly fine) then you need to set up DHCP server via software in CentOS on the laptop, and that will provide the IP address to the rasb_pi when it searches for one when the network cable is plugged into it.

You might also try using software like Wireshark in Centos to scan the network when the rasb_pi is connected to laptop deduce the 169.254.x.x IP address the rasb_pi drops to when it doesn't get one via dhcp.

Only once you know the ip address of the pi can you then SSH into it... like me trying to mail you something I can't do that unless I first know your address.

  • Do you mean something like this: unix.stackexchange.com/questions/295238/… – lycanthrope10100 Mar 20 at 12:21
  • basically. you need to do yum install dchp-server in centos. It might just be yum install dhcp. I typically use the software gui, just search on dhcp. You will already have the dhcp-client. You need the server part of dhcp, which when installed will be a service that runs in the background dishing out IP addresses to whatever asks for one on the network – ron Mar 20 at 12:25
  • you will then need to know what address dhcp server gives to your PI before you can SSH to it, so you will need to figure out a little bit about dhcp server configuration... since it's one device edit /etc/dhcp.conf or whatever and tell it only to handle one device connection and the range of valid IP addresses will be just one IP address – ron Mar 20 at 12:29
  • might be easier to install wireshark on centos, scan, find the 169.254.?.? IP address the PI shows up as, then SSH to that. – ron Mar 20 at 12:30
  • I don't think my Raspi is assigning itself an address because here on my laptop the 'Wired connecting' is going on and on and then stops. – lycanthrope10100 Mar 20 at 12:35
0

You need that your CentOS have a dhcp server configured and running to automatically deliver an IP address to your RaspPI. After, if you do not have a switch to connect the cables, you will need to use a Ethernet Crossover Cable to connected on your CentOS Ethernet rj45 port to the RJ45 port of RaspPI. So, your RaspPI will had an IP address and your CentOS can be ping and connect to ssh (if you know the user/password)

  • I did install the dhcp server on my laptop but i was not able to configure it to provide a single IP address to the Raspi. – lycanthrope10100 Mar 21 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.