!tCyGickeVqkHsYjWnh:nixos.org

NixOS Networking

907 Members
Declaratively manage your switching, routing, wireless, tunneling and more.262 Servers

Load older messages


SenderMessageTime
5 Jun 2021
@zhaofeng:zhaofeng.liZhaofeng LiCare to explain your setup again?23:56:34
@elvishjerricco:matrix.orgElvishJerricco Zhaofeng Li: I don't have a dhcp server or anything on this pi though 23:56:38
@elvishjerricco:matrix.orgElvishJerriccoOne sec...23:57:02
@elvishjerricco:matrix.orgElvishJerricco

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:matrix.orgElvishJerriccoeth0 leads back to enp4s0 on my desktop, which is running a dhcp server with its wifi interface as the wan23:59:30
@elvishjerricco:matrix.orgElvishJerricco

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:matrix.orgElvishJerricco

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:zhaofeng.liZhaofeng LiOh 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 started00:00:34
@elvishjerricco:matrix.orgElvishJerriccoAh. How would I mess with the unit files to ensure proper ordering?00:00:59
@zhaofeng:zhaofeng.liZhaofeng LiI 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 started00:02:27
@zhaofeng:zhaofeng.liZhaofeng LiOh it's a long-standing known issue: https://github.com/systemd/systemd/issues/93600:03:05
@zhaofeng:zhaofeng.liZhaofeng LiSo yeah, no clean solution :/00:03:26
@elvishjerricco:matrix.orgElvishJerriccoWell darn00:05:21
@hexa:lossy.networkhexa ElvishJerricco: hostapd can put stuff into a bridge, not sure how it achieves that, but networkd can't 00:08:32
@hexa:lossy.networkhexahave to read hostapd code for that I guess00:08:41
@hexa:lossy.networkhexaor yeah, might be a timing issue00:08:48
@elvishjerricco:matrix.orgElvishJerricco hexa: So I shouldn't have wlan0 in the br0.interfaces = [...] line? 00:09:11
@hexa:lossy.networkhexa
A WIFI interface needs to be set in 4addr mode before it's added to a bridge.
00:09:19
@hexa:lossy.networkhexathat's probably it00:09:23
@hexa:lossy.networkhexa
iw dev $name set 4addr on
00:09:33
@hexa:lossy.networkhexasadly networkd is free of hooks :)00:09:42
@hexa:lossy.networkhexaservices.hostapd.serviceConfig.ExecStartPost = "systemctl restart systemd-networkd";00:10:34
@hexa:lossy.networkhexashould probably hackfix your stuff :D00:10:42
@elvishjerricco:matrix.orgElvishJerriccoWell, 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 works00:13:37
@zhaofeng:zhaofeng.liZhaofeng LiFor the degraded thing, use LinkLocalAddressing=no to make networkd not try to add addresses to it at all00:16:30
@elvishjerricco:matrix.orgElvishJerricco Zhaofeng Li: Where do I add that? 00:19:07
@zhaofeng:zhaofeng.liZhaofeng LiTo the networkConfig of the wlan interface00:21:01
@noah:matrix.chatsubo.cafeChurch 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:lossy.networkhexanixos-simple-mailserrver?01:27:58
@noah:matrix.chatsubo.cafeChurchYa01:32:27

Show newer messages


Back to Room ListRoom Version: 6