1

I have a raspi image that I use to duplicate other pi's, sometimes I want to have more than one of them connected to my network so I can test things all at once. However, they get confused on the network as their network settings are the exact same. I tried to solve this by setting a static IP address for one pi, but each time I try to do that I can't get a successful ping.

I tried following the solution here How do I set up networking/WiFi/static IP address on Raspbian/Raspberry Pi OS?

but that didn't work. I'm pretty green on networking issues, so I'm not sure what else I can change to troubleshoot. Any help is appreciated.

ifconfig results:

        inet 192.168.50.10  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::8237:8fa8:2a06:c5c7  prefixlen 64  scopeid 0x20<link>
        ether c8:3e:a7:01:3e:ad  txqueuelen 1000  (Ethernet)
        RX packets 1313  bytes 230370 (224.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1050  bytes 137704 (134.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 358 bytes 33382 (32.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 358 bytes 33382 (32.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

cat /etc/resolv.conf results:

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver fd51:42f8:caae:d92e::1

route -ne results:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
192.168.0.1     0.0.0.0         255.255.255.255 UH        0 0          0 eth0
192.168.50.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0

sudo service dhcpcd status results:

   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2022-06-21 09:23:39 EDT; 7min ago
  Process: 983 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -b (code=exited, status=0/SUCCESS)
 Main PID: 1091 (dhcpcd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/dhcpcd.service
           └─1091 /sbin/dhcpcd -q -b

Jun 21 09:23:45 121321001 dhcpcd[1091]: control command: /sbin/dhcpcd --exit piright Jun 21 09:23:45 121321001 dhcpcd[1091]: piright: removing interface Jun 21 09:23:45 121321001 dhcpcd[1091]: control command: /sbin/dhcpcd --exit pileft Jun 21 09:23:45 121321001 dhcpcd[1091]: pileft: removing interface Jun 21 09:23:47 121321001 dhcpcd[1091]: eth0: using static address 192.168.50.10/24 Jun 21 09:23:47 121321001 dhcpcd[1091]: eth0: router 192.168.0.1 requires a host route Jun 21 09:23:47 121321001 dhcpcd[1091]: eth0: adding route to 192.168.50.0/24 Jun 21 09:23:47 121321001 dhcpcd[1091]: eth0: adding host route to 192.168.0.1 Jun 21 09:23:47 121321001 dhcpcd[1091]: eth0: adding default route via 192.168.0.1 Jun 21 09:24:09 121321001 dhcpcd[1091]: eth0: no IPv6 Routers available

TKnapp
  • 13
  • 3

2 Answers2

2

What subnet is the router on? the 192.168 subnets are 8-bits/0-255 (192.168.0.xx and 192.168.50.xx are not on the same subnet).

The gateway being 192.168.0.1 makes it seem like you should be assigning IP addresses in the 192.168.0 subnet

virmaior
  • 146
  • 6
  • My router has this info: IPv4 Address: 192.168.50.212 Subnet Mask: 255.255.255.0 Router: 192.168.50.1 – TKnapp Jun 21 '22 at 14:34
  • then the gateway should be set 192.168.50.212 so that it connects to your router to reach the internet. – virmaior Jun 21 '22 at 14:37
  • I think the 212 is my laptops IP address.. apologies if I gave incorrect information. – TKnapp Jun 21 '22 at 14:38
  • My router has this info: IPv4 Address: 192.168.50.212 and I think the 212 is my laptops IP address don't match. What is the IP address of the router itself? – virmaior Jun 21 '22 at 14:38
  • What is your dhcpcd.conf ? – virmaior Jun 21 '22 at 14:39
  • static ip_address=192.168.50.10/24 static ip6_address=fd51:42f8:caae:d92e::ff/64 static routers=192.168.0.1 static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

    Router IP is 192.168.50.1

    – TKnapp Jun 21 '22 at 14:40
  • change the router to 192.168.50.1 and the first domain name server to 192.168.50.1 (assuming this is the settings on your laptop). If not, then are you sure your laptop's 192.168.50.0/24 ? – virmaior Jun 21 '22 at 14:46
2

You said, "I'm pretty green on networking issues"

That statement suggests that you should not be using static IP addresses.

Did you know that dhcpcd comes with a default configuration in /etc/dhcpcd.conf that just works in most cases?

And I'm sorry, but I cannot let this statement from your question pass without comment: "However, they get confused on the network... "

I wonder how "they" got confused? :)

Seamus
  • 21,900
  • 3
  • 33
  • 70
  • The two pi's I am working with have the same dhcpd.conf files as they were booted with the same image, so yes they just work on their own, but when they are connected to the same network, then they don't just work. Perhaps my wording isn't perfectly accurate in terms of what is going on, but I bet someone with more knowledge than I have (as I pointed out, not well versed) can get enough of an understanding to either ask more questions to understand my issue or just understand where my knowledge is lacking to be able to help. Which I found to be true in this case with @virmaior's answer. – TKnapp Jun 23 '22 at 19:18
  • @TKnapp: That's fine - I am glad to hear you've resolved your issue(s). I appreciate your situation; I hope you can appreciate that what you are doing (replicating Pis w/ the same fixed IP address on the same network w/ no networking know-how) sounds like someone who is asking for trouble! My "answer" was actually a suggestion: Please research your problem before posting questions. – Seamus Jun 24 '22 at 06:18
  • I did research my issue but with the little knowledge that I have, it's hard to know what to look for and how to see potential downfalls. That comes with time and working in these areas often and I can't get that from a simple google search. IMO that's what these forums are for. I'd appreciate knowing what I'm doing that is asking for trouble as I can't see downfalls I've never experienced. Also, thank you for clearly defining what you were trying to say. I have autism and can't always read between the lines of suggestions with hidden content. – TKnapp Jun 24 '22 at 17:22
  • It comes with trying things; with making mistakes, reading and making more mistakes. I have autism, too - but I'll never use it as an excuse. – Seamus Jun 25 '22 at 01:23