Pi 4. Bookworm. Latest version. All updates. Trying to set up a DHCP server using a script.
Back in the dim dark ages of pre NetworkManager, I just used the Neanderthal approach of writing simple scripts to create DHCP servers, bridges, whatever. Now we all have to be wizards of nmtui despite it not doing what we want. Which then means we have to be nmcli geniuses. Image may be NSFW.
Clik here to view.
I started using nmcli in scripts to configure stuff and run into endless problems. Example. DHCP needs a static address on the DHCP server. I can set a static address on a machine using nmtui but to do the same in a script, I need nmcli commands and they seem to do something different. i tried to match the following nmtui creation with a nmcli script and do not get the same result.
After the nmcli static address setting, I tested options to set up DHCP using DNSMasq. Problems. The DHCP appears to not allocate anything. There are posts saying NetworkManager starts a separate instance of DNSMasq which blocks the regular one. Image may be NSFW.
Clik here to view.
I hope not.
Some of the best documentation online does not mention the OS version. The pages might work with NetworkManager prior to Bookworm but do not seem to work with Bookworm. Image may be NSFW.
Clik here to view.
After many days of battling the nmcli godzilla, I am close to giving up and reverting back to a previous OS for a decade or two, while NM documentation is refined.
The scripts I used previously let me set up any mixture of DHCP server, bridge, and NAT on one machine or across two, something I did back in the pre Pi 4 days. The other scripts for file server, etc, depend on the networking scripts working. If I need a Web server, click on script a, b, c, done.
Anyway the big battle today is to get DHCP working on a machine that will bridge eth0 to a WiFi access point, using a script I can rerun any time when I juggle my couple of Pi 4s through different experiments.
Back in the dim dark ages of pre NetworkManager, I just used the Neanderthal approach of writing simple scripts to create DHCP servers, bridges, whatever. Now we all have to be wizards of nmtui despite it not doing what we want. Which then means we have to be nmcli geniuses. Image may be NSFW.
Clik here to view.

I started using nmcli in scripts to configure stuff and run into endless problems. Example. DHCP needs a static address on the DHCP server. I can set a static address on a machine using nmtui but to do the same in a script, I need nmcli commands and they seem to do something different. i tried to match the following nmtui creation with a nmcli script and do not get the same result.
Code:
[connection]id=Wired connection 1uuid=9b6b3753-068b-3eb0-867a-d69a0f7663b9type=ethernetautoconnect-priority=-999interface-name=eth0[ethernet][ipv4]address1=192.168.0.4/24,192.168.0.1dns=1.0.0.1;method=manual[ipv6]addr-gen-mode=defaultmethod=disabled[proxy]
Clik here to view.

Some of the best documentation online does not mention the OS version. The pages might work with NetworkManager prior to Bookworm but do not seem to work with Bookworm. Image may be NSFW.
Clik here to view.

After many days of battling the nmcli godzilla, I am close to giving up and reverting back to a previous OS for a decade or two, while NM documentation is refined.
The scripts I used previously let me set up any mixture of DHCP server, bridge, and NAT on one machine or across two, something I did back in the pre Pi 4 days. The other scripts for file server, etc, depend on the networking scripts working. If I need a Web server, click on script a, b, c, done.
Anyway the big battle today is to get DHCP working on a machine that will bridge eth0 to a WiFi access point, using a script I can rerun any time when I juggle my couple of Pi 4s through different experiments.
Statistics: Posted by peterlite — Fri Jun 21, 2024 12:40 am — Replies 0 — Views 44