mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-10 22:52:41 +02:00
fix: dnsmasq dhcp
This commit is contained in:
@@ -13,6 +13,20 @@ NOTE: dae(running on aquamarine) do not provides http/socks5 proxy server, so a
|
|||||||
- check dae's log by `sudo journalctl -u dae`
|
- check dae's log by `sudo journalctl -u dae`
|
||||||
1. DNS & DHCP is provided by `dnsmasq` service, check the configuration of `dnsmasq`.
|
1. DNS & DHCP is provided by `dnsmasq` service, check the configuration of `dnsmasq`.
|
||||||
|
|
||||||
|
### DHCP cannot be obtained
|
||||||
|
|
||||||
|
1. `ss -tunlp`, check if `dnsmasq` is running and listening on udp port 67.
|
||||||
|
1. `journalctl -u dnsmasq` to check the log of `dnsmasq`.
|
||||||
|
1. Request a new IP address by disconnect and reconnect one of your devices' wifi.
|
||||||
|
1. `nix shell nixpkgs#dhcpdump` and then `sudo dhcpdump -i br-lan`, check if the DHCP request is received by `dnsmasq`.
|
||||||
|
1. The server listens on UDP port number 67, and the client listens on UDP port number 68.
|
||||||
|
1. DHCP operations fall into four phases:
|
||||||
|
1. Server **discovery**: The DHCP client broadcasts a DHCPDISCOVER message on the network subnet using the destination address 255.255.255.255 (limited broadcast) or the specific subnet broadcast address (directed broadcast).
|
||||||
|
1. IP lease **offer**: When a DHCP server receives a DHCPDISCOVER message from a client, which is an IP address lease request, the DHCP server reserves an IP address for the client and makes a lease offer by sending a DHCPOFFER message to the client.
|
||||||
|
1. IP lease **request**: In response to the DHCP offer, the client replies with a DHCPREQUEST message, broadcast to the server,[a] requesting the offered address.
|
||||||
|
1. IP lease **acknowledgement**: When the DHCP server receives the DHCPREQUEST message from the client, it sends a DHCPACK packet to the client, which includes the lease duration and any other configuration information that the client might have requested.
|
||||||
|
1. So if you see only `DISCOVER` messages, the dhsmasq is not working properly.
|
||||||
|
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
mainGatewayAddress = "192.168.5.1";
|
mainGatewayAddress = "192.168.5.1";
|
||||||
dhcpRange = {
|
dhcpRange = {
|
||||||
start = "192.168.5.50";
|
start = "192.168.5.50";
|
||||||
end = "102.168.5.99";
|
end = "192.168.5.99";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
# https://github.com/ghostbuster91/blogposts/blob/main/router2023-part2/main.md
|
# https://github.com/ghostbuster91/blogposts/blob/main/router2023-part2/main.md
|
||||||
@@ -116,8 +116,8 @@ in {
|
|||||||
services.resolved.enable = false;
|
services.resolved.enable = false;
|
||||||
services.dnsmasq = {
|
services.dnsmasq = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# resolve local queries (i.e. add 127.0.0.1 to /etc/resolv.conf)
|
# resolve local queries (add 127.0.0.1 to /etc/resolv.conf)
|
||||||
resolveLocalQueries = true;
|
resolveLocalQueries = false; # may be conflict with dae, disable this.
|
||||||
alwaysKeepRunning = true;
|
alwaysKeepRunning = true;
|
||||||
# https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=tree
|
# https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=tree
|
||||||
settings = {
|
settings = {
|
||||||
@@ -149,6 +149,7 @@ in {
|
|||||||
# Override the default route supplied by dnsmasq, which assumes the
|
# Override the default route supplied by dnsmasq, which assumes the
|
||||||
# router is the same machine as the one running dnsmasq.
|
# router is the same machine as the one running dnsmasq.
|
||||||
"option:router,${hostAddress}"
|
"option:router,${hostAddress}"
|
||||||
|
"option:dns-server,${hostAddress}"
|
||||||
];
|
];
|
||||||
|
|
||||||
# local domains
|
# local domains
|
||||||
|
|||||||
Reference in New Issue
Block a user