Introduction to Using dhcpcd on Raspberry Pi

Introduction to Using dhcpcd on Raspberry Pi

Note: If the external links in the text cannot be accessed, you can click on the “Read the original text” at the bottom.

Switching from Network-Manager to dhcpcd

::: warning After switching to dhcpcd, WiFi configuration will be lost. If you are connecting to the device via SSH through WiFi, please configure WiFi using raspi-config before switching:::

sudo systemctl enable dhcpcd
sudo systemctl start dhcpcd
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager

dhcpcd.conf

The /etc/dhcpcd.conf file saves common dhcpcd configurations, where you can set static IP, priority, etc.

Setting Static IP

Example:

#Example static IP configuration:
interface eth0
static ip_address=192.168.0.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

IPv6 is generally not used, and you can configure it according to the subnet mask of the set network segment, usually /24.

Setting Network Priority

Example: Set the network priority of WiFi to 200, the smaller the value, the higher the priority.

interface wlan0
metric 200

Prevent DHCPCD from Managing Networks

Example: Prevent dhcpcd from managing 4G wwan0, after configuration dhcpcd will no longer manage wwan0.

denyinterfaces wwan0

4G

Use dhcpcd to manage the network, dialing 4G requires installing a BSP package.

sudo apt update
sudo apt install ed-ec20-qmi
sudo systemctl enable lte-reconnect
sudo systemctl start lte-reconnect

After installing and enabling the service, reboot to automatically dial.

If you find that there is no 4G network, you can refer to [Check 4G Network Steps]

Leave a Comment

Your email address will not be published. Required fields are marked *