| 5 Jun 2021 |
Zhaofeng Li | Care to explain your setup again? | 23:56:34 |
ElvishJerricco | Zhaofeng Li: I don't have a dhcp server or anything on this pi though | 23:56:38 |
ElvishJerricco | One sec... | 23:57:02 |
ElvishJerricco | On my pi, I have this:
networking.bridges.br0.interfaces = ["eth0" "wlan0"];
services.hostapd = {
enable = true;
interface = "wlan0";
hwMode = "g";
ssid = "My Pi Network";
wpaPassphrase = "foobarbaz";
extraConfig = ''
disable_pmksa_caching=0
wpa_pairwise=CCMP
rsn_pairwise=CCMP
bridge=br0
'';
};
| 23:59:01 |
ElvishJerricco | eth0 leads back to enp4s0 on my desktop, which is running a dhcp server with its wifi interface as the wan | 23:59:30 |
ElvishJerricco | On the desktop:
let
wan = "wlp5s0";
lan = "enp4s0";
in {
services.dhcpd4 = {
interfaces = [ lan ];
enable = true;
extraConfig = ''
subnet 192.168.3.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.3.255;
option routers 192.168.3.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
range 192.168.3.100 192.168.3.200;
}
'';
};
networking = {
networkmanager.unmanaged = [ lan ];
interfaces = {
${lan} = {
ipv4.addresses = [{
address = "192.168.3.1";
prefixLength = 24;
}];
};
};
nat = {
enable = true;
externalInterface = wan;
internalIPs = [ "192.168.3.0/24" ];
internalInterfaces = [ lan ];
};
};
}
| 23:59:58 |
| 6 Jun 2021 |
ElvishJerricco | Woops, pi also has this:
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = false;
networking.interfaces.wlan0.useDHCP = false;
networking.interfaces.br0.useDHCP = true;
| 00:00:33 |
Zhaofeng Li | Oh wait, apparently I can't read and you are using it as an AP 😐️ Then it should work and systemd-networkd was probably trying to bridge the interface before hostapd started | 00:00:34 |
ElvishJerricco | Ah. How would I mess with the unit files to ensure proper ordering? | 00:00:59 |
Zhaofeng Li | I don't think there's a clean solution to this one unfortunately. You can keep it unbridged in networkd and add a service that runs brctl after hostapd has started | 00:02:27 |
Zhaofeng Li | Oh it's a long-standing known issue: https://github.com/systemd/systemd/issues/936 | 00:03:05 |
Zhaofeng Li | So yeah, no clean solution :/ | 00:03:26 |
ElvishJerricco | Well darn | 00:05:21 |
hexa | ElvishJerricco: hostapd can put stuff into a bridge, not sure how it achieves that, but networkd can't | 00:08:32 |
hexa | have to read hostapd code for that I guess | 00:08:41 |
hexa | or yeah, might be a timing issue | 00:08:48 |
ElvishJerricco | hexa: So I shouldn't have wlan0 in the br0.interfaces = [...] line? | 00:09:11 |
hexa |
A WIFI interface needs to be set in 4addr mode before it's added to a bridge.
| 00:09:19 |
hexa | that's probably it | 00:09:23 |
hexa |
iw dev $name set 4addr on
| 00:09:33 |
hexa | sadly networkd is free of hooks :) | 00:09:42 |
hexa | services.hostapd.serviceConfig.ExecStartPost = "systemctl restart systemd-networkd"; | 00:10:34 |
hexa | should probably hackfix your stuff :D | 00:10:42 |
ElvishJerricco | Well, simply removing it from the br0.interfaces makes it "degraded" instead of "failed", and hostapd does seem to have added it to the bridge itself as the wifi still works | 00:13:37 |
Zhaofeng Li | For the degraded thing, use LinkLocalAddressing=no to make networkd not try to add addresses to it at all | 00:16:30 |
ElvishJerricco | Zhaofeng Li: Where do I add that? | 00:19:07 |
Zhaofeng Li | To the networkConfig of the wlan interface | 00:21:01 |
Church | hexa So got my mailserver working heh. Nice and smooth like as far as outgoing. Just need to get ingoing smtp from remotes to my mail server working. But that's a job for another day. | 01:25:36 |
hexa | nixos-simple-mailserrver? | 01:27:58 |
Church | Ya | 01:32:27 |