This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| computing:dhcpcd [2026/09/07 16:03] – created oemb1905 | computing:dhcpcd [2026/09/07 17:01] (current) – oemb1905 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Debian deprecated isc-dhcp-client and replaced it dhcpcd. | + | ------------------------------------------- |
| + | * **dhcpcd** | ||
| + | * **Jonathan Haack** | ||
| + | * **Haack' | ||
| + | * **webmaster@haacksnetworking.org** | ||
| + | |||
| + | ------------------------------------------- | ||
| + | |||
| + | //Managing dhcpcd with ifupdown and Network Manager// | ||
| + | |||
| + | ------------------------------------------- | ||
| + | |||
| + | Cockpit has advanced logging features for networking but it requires Network Manager. Additionally, | ||
| + | |||
| + | < | ||
| + | [main] | ||
| + | plugins=ifupdown, | ||
| + | |||
| + | [ifupdown] | ||
| + | managed=true | ||
| + | </ | ||
| + | |||
| + | Restart Network Manager '' | ||
| < | < | ||
| Line 17: | Line 39: | ||
| </ | </ | ||
| - | Once this is done, you make sure Network Manager | + | You would think this would be enough! But no, Network Manager |
| - | < | + | {{ : |
| - | [main] | + | {{ : |
| - | plugins=ifupdown, | + | |
| - | [ifupdown] | + | This stops the interfaces themselves from getting an IP from Network Manager. Do this for all the physical NICs. If you don't do this, then Network Manager will cause gateway issues by assigning these NICs a second IP on those subnets. We are done now, right? Not so fast ... Network Manager will also, by default, pick up DNS via the bridges themselves! So, after all these changes, you need to open each bridge up and specify " |
| - | managed=true | + | |
| - | </code> | + | {{ : |
| + | {{ : | ||
| + | |||
| + | Okay, we are finally done. You can now safely run Network Manager alongside | ||
| + | |||
| + | ip route show default | ||
| + | |||
| + | This should show something like: | ||
| + | |||
| + | default via 172.50.50.1 dev br2 proto dhcp src 172.33.33.2 metric 1140 | ||
| + | default via 172.18.18.1 dev br3 proto dhcp src 172.34.34.2 metric 1141 | ||
| + | default via 10.18.18.1 dev br0 proto dhcp src 10.48.48.2 metric 1142 | ||
| + | |||
| + | Not only did it create routes, it also screwed up priority. Now, if you want these routes, you can set priority in interfaces easily. Personally, I just want the bridges for vms/ | ||
| + | |||
| + | ip route del default via 172.33.33.1 dev br2 #example | ||
| + | ip route del default via 172.34.34.1 dev br3 #example | ||
| + | |||
| + | After this, I restarted Network Manager, restarted networking and then made sure that everything remained the way I set it up. | ||
| + | |||
| + | sudo systemctl restart networking | ||
| + | sudo systemctl restart NetworkManager | ||
| + | ip route show default | ||
| + | default via 10.48.48.1 dev br0 proto dhcp src 10.18.18.2 metric 10 | ||
| + | cat / | ||
| + | nameserver 10.48.48.150 | ||
| + | nameserver 10.48.48.160 | ||
| + | nameserver fdf7: | ||
| + | nameserver fdf7: | ||
| + | |||
| + | You can now reboot, restart each service and DNS is not altered, nor is the gateway. This only took about a year to figure out. It was much easier in isc-dhcp-client; | ||
| + | |||
| + | ------------------------------------------- | ||
| + | |||
| + | === Updates === | ||
| + | |||
| + | It is not enough to simply instruct dhcpcd to not set routes for the bridges, you also have to tell Network Manager the same. To do this, open nm-connection-editor and open the routes submenu in each bridge. Click both the options there for all the IoT or restricted bridges; leave the primary or private bridge untouched. Then, restart networking and NetworkManager and you should only see the default route for the private subnet/lan. Here is what that looks like: | ||
| - | Then, lastly, you also need to stop Network Manager from messing with DNS. So, first, disable ipv4 and ipv6 on the ethernet interfaces in nm-connection-editor. This stops the interfaces themselves from getting an IP from Network Manager. We don't want this because ifupdown already gives the same subnet an address on the bridge, so no need for the interface to also have an address. Additionally, | + | {{ : |
| + | This worked flawlessly on two machines. However, one machine insisted on making routes no matter what I did. So, for that machine, I additionally stopped Network Manager from doing that using nmcli: | ||
| + | nmcli connection modify br1 ipv4.ignore-auto-routes yes ipv6.ignore-auto-routes yes | ||
| + | nmcli connection modify br2 ipv4.ignore-auto-routes yes ipv6.ignore-auto-routes yes | ||
| + | nmcli connection modify br3 ipv4.ignore-auto-routes yes ipv6.ignore-auto-routes yes | ||
| - | Then, lastly, | + | If you instead |
| + | nmcli connection modify br1 ipv4.never-default yes ipv6.never-default yes | ||
| + | nmcli connection modify br2 ipv4.never-default yes ipv6.never-default yes | ||
| + | nmcli connection modify br3 ipv4.never-default yes ipv6.never-default yes | ||
| + | Just adapt this command to whatever your bridges are named. This final change took care of the most stubborn machine I had. | ||
| - | + | --- // | |
| - | + | ||