-1

I have two Pi-4s, each with a unique static eth0 address; I use this connection for admin support.. They're running Buster.

I want the two Pi's to communicate to each other via Wifi and UDP. No router will be present. They must have known addresses so that #1 can broadcast to #2 using UDP; so, static IP on the Wifi side also.

All the ad-hoc examples seem to ignore existing networks - and attempting to set it up breaks the existing eth0 static IP setup in DHCP.

I could set one of the Pi's up as an access point, but I don't need bridging or routing.. I just want them to 'see' each other over the Wifi. The access point examples I find tend to include the other things, including dhcp ranges, bridging, etc that I don't need.

Can anyone suggest a simple means of getting the two Pi's communicating so that #1 can broadcast to #2 via WiFi, and continue to allow me access via ssh through the ethernet interface?

Thank you,

Mark

1
  • "breaks the existing eth0 static IP setup in DHCP" "No router will be present" so where does DHCP come from? It should be possible to setup an ad-hoc wireless network independently of Ethernet. What have you tried that doesn't work? Frankly with 2 nodes ad-hoc makes no sense an Access Point would be better. Commented Jun 10, 2023 at 2:09

1 Answer 1

0

I went back to trying to set up the receiving device as an access point.

The problems I was having was that the SSID and passphrase I used were too short; there is an 8-character minimum.

Attempting to start hostapd would say it failed, and journalctl -xe would report "failed to start advanced ieee 802.11 ap and ieee 802.1x/wpa/wpa2/eap authenticator".

Because I'm using fixed IP addresses for each device I was looking for the most simple configuration, and not using ip routing or bridging.

The configuration changes required to make this work follows:

Added two lines to /etc/dhcpcd.conf:

static ip_address=192.168.XX.YYY/24

(note that XX.YYY should be replaced with your choice)

Next, I added these two lines to /etc/dbsmasq.conf:

dhcp-range=192.168.XX.1,192.168.XX.20,255.255.255.0,24h

(Again, XX represents your choice, as should the range you choose)

Next, /etc/hostapd/hostapd.conf reads like this:

interface=wlan0
country_code=US
driver=nl80211
ssid=MyGreatSSID
hw_mode=g
channel=7
wmm_enabled=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=MyGreatPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Where MyGreatSSID is a substitute for the one I use. No quotes around it in the file, btw.. and MyGreatPassword is the substitute (in this example) for our actual password.

Last item, point hostapd to the file, editing /etc/default/hostapd:

Update this line: DAEMON_CONF= to this: DAEMON_CONF="/etc/hostapd/hostapd.conf"

There was an entry in /etc/rc.local to down the wlan0 interface that I changed it to bring it up; it was there from 'before', and I don't know if it comes that way by default or some previous project had left it there.

Reboot - and I was able to connect from Windows 10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.