I'm trying to set up the Pi 4B as an access point for a device (headless standard Raspbian). Therefore I have plugged in a WiFi dongle which is correctly found as wlan1. I want to install a dhcp server on this connection, so the device needs a static IP.
I have modified the dhcpcd.conf to assign a static IP. However, no matter what I try this IP is not assigned to the adapter.
Two other points are very strange to me too:
- If I set up the whole thing defining the static IP in /etc/netwok/interfaces it works (but is not possible due to other reasons)
- If I set up the static IP for a different adapter (e.g. eth0) it is assigned without a problem. Everything else is the same, just the adapter was changed from wlan1 to eth0
Can anybody tell me what I'm doing wrong?
dhcpcd startup:
Mar 11 14:59:24 raspberrypi systemd[1]: Starting dhcpcd on all interfaces...
Mar 11 14:59:24 raspberrypi dhcpcd[394]: dev: loaded udev
Mar 11 14:59:25 raspberrypi dhcpcd[394]: wlan1: connected to Access Point `'
Mar 11 14:59:25 raspberrypi dhcpcd[394]: eth0: waiting for carrier
Mar 11 14:59:25 raspberrypi dhcpcd[394]: usb0: waiting for carrier
Mar 11 14:59:25 raspberrypi dhcpcd[394]: wlan1: waiting for carrier
Mar 11 14:59:29 raspberrypi dhcpcd[394]: eth0: carrier acquired
Mar 11 14:59:29 raspberrypi dhcpcd[394]: DUID 00:01:00:01:27:c3:1b:28:dc:a6:32:f3:fd:66
Mar 11 14:59:29 raspberrypi dhcpcd[394]: eth0: IAID 32:f3:fd:20
Mar 11 14:59:29 raspberrypi dhcpcd[394]: eth0: adding address fe80::2082:5f86:a7d3:5b95
Mar 11 14:59:29 raspberrypi dhcpcd[394]: eth0: soliciting a DHCP lease
Mar 11 14:59:30 raspberrypi dhcpcd[394]: eth0: soliciting an IPv6 router
Mar 11 14:59:34 raspberrypi dhcpcd[394]: eth0: probing for an IPv4LL address
Mar 11 14:59:39 raspberrypi dhcpcd[394]: eth0: using IPv4LL address 169.254.89.112
Mar 11 14:59:39 raspberrypi dhcpcd[394]: eth0: adding route to 169.254.0.0/16
Mar 11 14:59:39 raspberrypi dhcpcd[394]: eth0: adding default route
Mar 11 14:59:39 raspberrypi dhcpcd[394]: forked to background, child pid 579
Mar 11 14:59:39 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
/etc/dhcpcd.conf:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
Inform the DHCP server of our hostname for DDNS.
hostname
Use the hardware address of the interface for the Client ID.
clientid
or
Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
Some non-RFC compliant DHCP servers do not reply with this set.
In this case, comment out duid and enable clientid above.
#duid
Persist interface configuration when dhcpcd exits.
persistent
Rapid commit support.
Safe to enable by default because it requires the equivalent option set
on the server to actually work.
option rapid_commit
A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
Most distributions have NTP support.
#option ntp_servers
A ServerID is required by RFC2131.
require dhcp_server_identifier
Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
denyinterfaces wlan0
Example static IP configuration:
interface wlan1
static ip_address=192.168.135.199/16
static routers=192.168.135.254
static domain_name_servers=192.168.135.254
nohook wpa_supplicant
/etc/network/interfaces:
# interfaces(5) file used by ifup(8) and ifdown(8)
Please note that this file is written to be used with dhcpcd
For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
#allow-hotplug wlan0
#iface wlan0 inet manual
allow-hotplug wlan1
iface wlan1 inet manual
ifconfig still says:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.89.112 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::2082:5f86:a7d3:5b95 prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:f3:fd:20 txqueuelen 1000 (Ethernet)
RX packets 59 bytes 11942 (11.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 549 bytes 30983 (30.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 330 bytes 31350 (30.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 330 bytes 31350 (30.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 22:65:38:71:77:e3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 7c:dd:90:ad:bf:35 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0