0

I have a Dragino-Yun v2.4-shield, which is a device that can be connected with an Arduino to give it networking-capabilities. It has An Ethernet-Port and Wifi. I don't have a wifi-antenna at the moment so i tried connecting to it via the Ethernet-Port.

According to the manual, the address 172.31.255.254 is assigned to the Ethernet-Port in a /4 subnet (DNS-mask: 255.255.255.252). I started with a blank Arch-Linux-ISO on a ThinkPad and got it so far, as to pinging the device was succesfull. According to the manual it should also be possible to connect via ssh, but that didn't work.

I then rebooted and wanted to ran the commands cleanly, but didn't have any success on the second try. Here are the commands i ran, following this Archwiki-page (enp0s25 is the ethernet-link of my ThinkPad):

$ systemctl stop dhcpcd
$ ip link set enp0s25 up  # It is up by default though
$ ip addr add 172.31.255.253/4 dev enp0s25
$ ip route add default via 172.31.255.252
$ ping 172.31.255.254 -c3
PING 172.31.255.254 (172.31.255.254) 56(84) bytes of data.
FROM 172.31.255.253 icmp_seq=1 Destination Host Unreachable
FROM 172.31.255.253 icmp_seq=2 Destination Host Unreachable
FROM 172.31.255.253 icmp_seq=3 Destination Host Unreachable
--- 172.31.255.254 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4054ms
pipe 3

I will add, that i have very little networking-experience. Where am i wrong? Is there something i've missed?

1 Answer 1

0

First, ip addr does not automatically know the netmask. It is impossible to determine that from just the address itself, so you must specify the /prefixlen along with it. If you forget to do that, then the address will be added as /32 (single-host) and you will not be able to reach the rest of your subnet.

Second, your netmask is not a /4, it's a /30. The slash notation is used to indicate bit length of the netmask, not the literal subnet size. So the correct command would be:

ip addr add 172.31.255.253/30 dev enp0s25

(You can calculate /length as 32−log2(size) and size as 2(32-length), or just count the bits.)

Also, it'a "netmask" or "subnet mask" and not "DNS-mask", as it has nothing to do with DNS.


I see you're also specifying a rather unusal address as the gateway. With your netmask, .252 is the "zeroth" address of the subnet, and is usually considered reserved in IPv4. (Are you perhaps confusing 'gateway' and 'network address'?)

However, communications within the same subnet do not need a gateway in the first place – that's what a subnet is – so you can just skip that ip route add line entirely for now.


Finally, "Destination Host Unreachable" often means a different kind of error: it means the OS does know that the address is within a local subnet, but isn't receiving any responses from trying to look up its MAC address using ARP. (That step is mandatory before sending anything to a same-subnet device.)

Try to make manual ARP queries (similar to what the OS does) – if they succeed, then something is still wrong with your IP configuration:

arping -I enp0s25 172.31.255.254
4
  • Thanks for the answer! I did indeed run ip addr .../4 .... Edited the question. Will try your solution out immediately.
    – Tim Hilt
    Mar 26, 2020 at 11:18
  • In your case, specifying a too-large subnet (too-short prefix length) shouldn't actually make the Arduino unreachable – it includes more than needed, but doesn't exclude what's necessary. (It can cause other problems though, such as being unable to reach 160.0.0.0–175.255.255.255 which are unnecessarily included.) Mar 26, 2020 at 11:19
  • I tried it out. The ping still returns Destination Host Unreachable and the arping doesn't receive anything either. And you're probably right about me confusing subnet- and DNS-mask. I wonder why it worked before though!
    – Tim Hilt
    Mar 26, 2020 at 11:30
  • I know why it worked! I didn't ping 172.31.255.254, but 172.31.255.253, which means i pinged myself. No wonder that worked
    – Tim Hilt
    Mar 27, 2020 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .