0

Currently, I have configured access point using hostapd and using systemd for configure the network ap0 (access point device).

the access point configured automatically to use DHCP server.

my question is that is there any way to set my own DHCP ip range for using systemd? I have been googling and I can't find any clue how to do it.

  • If I understand your question right and you want to configure a DHCP server with systemd, just run man systemd.network where you'll find all options. – jake Sep 13 at 8:55
  • @jake I assume this comment is sarcasm. The man (in typical Debian fashion) is voluminous and opaque - I am sure the author knows what it means, but I defy any mere mortal (who is not a networking expert) to derive any useful information from it. – Milliways Sep 13 at 12:10
  • @Milliways wasn't meant this way. I should have given the right section [DHCPSERVER] as well which, I think is very easy to understand. – jake Sep 13 at 12:26
0

If you ask to configure DHCP in systemd I assume you mean to use systemd-networkd. Then with "automatically" enabled DHCP server you must have a DHCPServer=yes line in the [Network] section of your *.network file. You can add a section [DHCPServer] with additional options. Here is an example:

rpi ~# cat /etc/systemd/network/12-ap0.network
[Match]
Name=ap0
[Network]
Address=192.168.4.1/24
DHCPServer=yes
[DHCPServer]
DNS=84.200.69.80 1.1.1.1
PoolOffset=128
PoolSize=32

As you see you can use PoolOffset and PoolSize to define the ip range to be used by the DHCP server. PoolOffset= takes the offset of the pool from the start of the subnet (192.168.4.0/24, determined by Address=192.168.4.1/24), PoolSize= takes the number of IP addresses in the pool.

For further information look at man systemd.network section [DHCPSERVER].


Reference:
Access point as WiFi router/repeater, optional with bridge

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.