No ip to ssh into rpi3 (direct ethernet connection)

Ask questions about Arch Linux ARM. Please search before making a new topic.

No ip to ssh into rpi3 (direct ethernet connection)

Postby justintan2002 » Mon Jan 13, 2020 4:27 pm

I am attempting to ssh into the raspi (armv7) using ethernet from my laptop which is running ubuntu. However, there isn't any ip assigned to eth0 on both my laptop and the pi. When the pi is connected to the ethernet port from the router it is assigned an ip which means that the port is working. I was able to successfully ssh into the pi using wifi but not direct ethernet connection. Here are some of the details from the pi:

$this->bbcode_second_pass_code('', 'ip addr
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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether b8:27:eb:bd:fc:dc brd ff:ff:ff:ff:ff:ff
inet6 fe80::ba27:ebff:febd:fcdc/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether b8:27:eb:e8:a9:89 brd ff:ff:ff:ff:ff:ff
inet 192.168.43.83/24 brd 192.168.43.255 scope global dynamic noprefixroute wlan0
valid_lft 3363sec preferred_lft 2796sec
inet6 fe80::ba27:ebff:fee8:a989/64 scope link
valid_lft forever preferred_lft forever')

$this->bbcode_second_pass_code('', 'route -ne
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.43.1 0.0.0.0 UG 0 0 0 wlan0
192.168.43.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0')

$this->bbcode_second_pass_code('', 'cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.43.1')

$this->bbcode_second_pass_code('', 'cat /etc/dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
noipv4ll')
justintan2002
 
Posts: 5
Joined: Mon Jan 13, 2020 4:21 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby moonman » Mon Jan 13, 2020 10:00 pm

Are you connecting your Pi to the laptop directly? If so then it makes sense since you don't have DHCP server running to assign IPs anymore. Set static IPs to both then.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby justintan2002 » Tue Jan 14, 2020 2:22 am

$this->bbcode_second_pass_quote('moonman', 'A')re you connecting your Pi to the laptop directly? If so then it makes sense since you don't have DHCP server running to assign IPs anymore. Set static IPs to both then.


Yes I am connecting the pi directly. However, when I connected another pi running raspbian to the same laptop, there was an ip under inet (ip addr), allowing me to ssh into the pi successfully. Is there any way to achieve this or setting static ip on both devices is the only way?
justintan2002
 
Posts: 5
Joined: Mon Jan 13, 2020 4:21 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby summers » Tue Jan 14, 2020 6:05 am

First of, make sure you are using systemd-networkd and not using netctl. Systemd can do dhcp internally, but with netctl you need to use dhcp separately. So netctl can have race problems if you have several network connections, but with systemd you can set up separately on each network connection.

Now one machine will have to be a dhcp server, and it will set up the network, so that machine will need to know how to set up network.

On that machine in /etc/systemd/network/usb0.network do
$this->bbcode_second_pass_code('', '[Match]
Name=usb0

[Network]
DNS=192.168.2.1
DHCPServer=true

[Address]
Address=192.168.7.18/30

[Route]
Gateway=192.168.7.17

[DHCPServer]
EmitDNS=false
EmitNTP=false
EmitSIP=false
EmitRouter=false
')

On the other machine, best to make it aware that that DHCP is running on the port, so set up something like:

In /etc/systemd/network/usb.network do
$this->bbcode_second_pass_code('', '[Match]
Name=usb*

[Network]
DHCP=true
IPForward=true
')

You'll obviously have to change the names to what your ethernet connection is knows as, the above is for a pocket beagle which has USB otg, and it enables usb gadget, which brings up a virtual ethernet socket on USB. If using something else you'll have to change names.

Now to explain, see that the server knows its own IP address, and what is on the subnet (/30 - means one other machine). It knows the gateway (here assumed the machine on the other end). It also needs to know what machine does DNS, in my case my ADSL router.

Notice that also under DHCPServer it disables emitting most things, if you don't do this, dhcp will try and set up these things on the far machine, so make sure what you want - it depends critically on which machine is the server, and what it knows. E.g. a server with internet connection probably knows about DNS, but a server with no internet connection knows nothing of DNS/NTP or the route to the internet.

Notice that the the machine accepting the DNS server, in this case has IPForward set - so it knows to send on packets it recieves, that are not for that machine. So in my case its that machine that knows the way to the internet (note I also run a firewall on that machine which also takes part in forwarding, not clear if that is needed.

After doing all this, its just simple plug and play.
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby justintan2002 » Wed Jan 15, 2020 3:30 pm

Thank you so much for your help!!! :)

My laptop is running ubuntu which uses network manager by default. Do I need to disable network manager or can systemd networkd work alongside network manager?
justintan2002
 
Posts: 5
Joined: Mon Jan 13, 2020 4:21 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby summers » Wed Jan 15, 2020 4:00 pm

You should be OK running systemd-networkd on the RPi, and have that running a DHCP server.

Ubuntu almost certainly will try dhcp to get a IP address when it detects activity on the ethernet port. Problem is though it probably won't forward internet traffic on via the ubunntu machine internet connection, so it probably won't give you an internet connection if you need it on the RPi, e.g. for updates.

I never looked into how to get ubunutu to forward internet traffic, machines I've had in the past with ubuntu on have been on the end of the LAN connection, and so had no need to forward traffic.
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby graysky » Wed Jan 15, 2020 5:56 pm

Alternatively I *think* you can configure your Pi to run with a static network setup. See the Arch Wiki (systemd-networkd)... your setup is a bit peculiar at least to me... usually you have all devices go through your home router (DHCP). You can purchase an unmanaged switch pretty inexpensively if your router lacks the free number of ports.
graysky
Developer
 
Posts: 1876
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby justintan2002 » Thu Jan 16, 2020 10:26 am

@summers your method works! Thanks!
justintan2002
 
Posts: 5
Joined: Mon Jan 13, 2020 4:21 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby summers » Thu Jan 16, 2020 8:16 pm

Glad it worked. Were you able to connect to the internet from the RPi via the Laptop?
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Re: No ip to ssh into rpi3 (direct ethernet connection)

Postby summers » Sat Jan 25, 2020 2:10 pm

JIKITA, suggest you read the posts above. This is what this thread has already answered.
summers
 
Posts: 995
Joined: Sat Sep 06, 2014 12:56 pm

Next

Return to User Questions

Who is online

Users browsing this forum: No registered users and 3 guests