I am running ubuntu server 19.10 on a raspberry pi. My pi is connected to a wifi router and to an ethernet switch, with interface names wlan0 and eth0 respectively.
I want to create a static ip address for my wlan0 connection. I'm used to raspbian and this is my first serious foray into ubuntu server.
When I look into
/etc/netplan/, there is a single yml file with the contents:
network: ethernets: eth0: dhcp4: true optional: true version: 2
Since there's no mention of wlan0 in here, I assumed that ubuntu is not operating a dhcp client for wlan0. I therefore installed dhcpcd5 and configured it to ask for a static ip address (192.168.1.202). However, the wifi router now seems to be giving my device two ip addresses; one is the one I asked for in /etc/dhcpcd.conf, the other must be (I think) via netplan. Both work when I try ssh-ing to the device.
I want to figure out why I am getting two addresses and how to prevent it.
When I print-out dhcp-relevant lines from
/var/log/syslog, I get the following:
... dhcpcd: wlan0: carrier acquired ... dhcpcd: wlan0: IAID eb:25:ec:d9 ... dhcpcd: wlan0: adding address XXX ... dhcpcd: wlan0: IAID eb:25:ec:d9 ... dhcpcd: wlan0: adding address XXX ... NetworkManager: <info> [1573233133.0889] dhcp4 (wlan0): activation: beginning transaction (timeout in 45 seconds) ... dhcpcd: wlan0: probing address 192.168.1.202/24 ... dhcpcd: wlan0: probing address 192.168.1.202/24 ... NetworkManager: <info> [1573233133.1426] dhcp4 (wlan0): state changed unknown -> bound ... dhcpcd: wlan0: using static address 192.168.1.202/24 ... dhcpcd: wlan0: adding route to 192.168.1.0/24 ... dhcpcd: wlan0: no IPv6 Routers available
So it looks like dhcpcd5 is functioning as normal, but then there is this surprise entry from
dhcp4. Furthermore, when I try
ifconfig wlan0, I find that my device thinks its wlan0 ip address is NOT the one I requested via dhcpcd5, which is surprising, since my most recent logs suggested that it was adding that route to my wifi router, but then it doesn't seem to write the result to my device locally.
I'd greatly appreciate clarity here, namely:
1a. Why doesn't netplan show info for wlan0 in
1b. How can I disable netplan's dhcp4 service?
- General recommendations are welcome as to how best to set up static ip addresses. Is it a bad idea to install dhcpcd5 on ubuntu in place of its native set up? etc.