0

I have a Pi3B+ (running Buster) that connects to my WLAN nicely via normal wpa_supplicant.conf means.

~ $ ip -4 addr show | grep global
inet 169.254.60.134/16 brd 169.254.255.255 scope global noprefixroute eth0
inet 10.0.0.14/24 brd 10.0.0.255 scope global noprefixroute wlan0

I'd like eth0 to be able to talk to a device that comes pre-configured to:

dhcp: off
ip: 192.168.1.25
subnet: 255.255.255.0
gateway: 0.0.0.0

Ideally, I would directly plug in the device and be able to talk with it, but the device need not any internet access; just device-to-pi communication.

Is the right way to do this installing isc-dhcp-server? Can I set this up statically somehow?

I did try installing isc-dhcp-server following some similar-but-not-quite-the-same-use-case resources, but I ended up with the pi unable to "see" the internet (which I would like it to still be able to do via wlan0).

FWIW, if I set the device to have DHCP on and connect to a router on the same network as hosts the pi's WLAN, all works perfectly (which is probably obvious, but just to demonstrate that all the pieces basically work).

Ideas?

Thanks! :)

Followup info:

I started trying to set up a static IP, but wasn't having any luck... I'm sure it's my error.

So far in /etc/dhcpd.conf I've tried:

interface eth0
static ip_address=192.168.1.1/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 8.8.8.8

...and...

interface eth0
static ip_address=192.168.1.1/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=0.0.0.0
static domain_name_servers=1.1.1.1 8.8.8.8

...with no luck. Can you see what I'm getting wrong?

Following up with more information:

Currently in /etc/dhcpd.conf:

interface eth0
static ip_address=192.168.1.1/24

Then here's what @ingo asked for:

~ $ 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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:6a:60:12 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global noprefixroute eth0
    valid_lft forever preferred_lft forever
    inet6 fe80::c06d:1f08:cc48:4736/64 scope link 
    valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:3f:35:47 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.14/24 brd 10.0.0.255 scope global noprefixroute wlan0
    valid_lft forever preferred_lft forever
    inet6 fe80::2ab4:1087:6f56:d4ad/64 scope link 
    valid_lft forever preferred_lft forever

~ $ ip route
default via 10.0.0.1 dev wlan0 proto dhcp src 10.0.0.14 metric 303 
10.0.0.0/24 dev wlan0 proto dhcp scope link src 10.0.0.14 metric 303 
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.1 metric 202 

~ $ cat /proc/sys/net/ipv4/ip_forward
0

I'm thinking that seems good, but I still can't ping .25 from. the .1 pi. (This was an unrelated problem. See my answer for mistakes I made.)

0

For the information you have given I can't see why to install a dhcp server. It's also a bit dangerous if you don't know what you are doing because on a subnet (exactly on a broadcast domain) there must be only one dhcp server. That may conflict with an already running dhcp server on your internet router.

The simplest solution is to give interface eth0 a static ip address of the subnet from the device, for example 192.168.1.1/24.

  • I saw that afterward... sorry... updated... – papakpmartin Sep 6 at 16:16
  • There is no connection to the internet on the subnet 192.168.1.0/24 so don't use entries for static routers and static domain_name_servers. Please paste the output of ip addr and ip route into the question when you have set the static ip address and rebooted. cat /proc/sys/net/ipv4/ip_forward should return 0. – Ingo Sep 6 at 16:27
  • Info is above... I re-edited it because I had a dumb off-topic problem in having mis-configured something while thrashing. – papakpmartin Sep 6 at 17:33
0

@ingo was exactly right, and what he recommended worked perfectly.

All other problems I has were caused by thrashing prior to asking the question here.

Things I did wrong:

  • Enabled predictable network interface names using raspi-config; "normal" is disabled, and enabling changes "eth0" into something presumably "random" and henceforth reliable.
  • Didn't verify the IP address of the target device (the 192.168.1.25 device I was trying to talk with)

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.