Commit Graph

85 Commits

Author SHA1 Message Date
Jade Lovelace
cc63754f56 nixos/tests: fix networking under network-online dep fix 2024-01-18 16:28:42 -08:00
Maximilian Bosch
083a10949a
Merge pull request #258695 from Majiir/fix-networkd-defaultgateway
nixos/network-interfaces-systemd: support and require defaultGateway.interface
2023-10-15 16:42:01 +02:00
Majiir Paktu
c4228b6c8f nixos/network-interfaces-systemd: fix DHCP setting
The networkd backend logic for setting DHCP= on an interface is bugged
and inconsistent with the scripted logic. Consider this simple NixOS
configuration:

    {
      networking.useNetworkd = true;
      networking.interfaces.eth0.wakeOnLan.enable = true;
    }

The default value of networking.useDHCP is true, so we expect our eth0
interface to have DHCP enabled. With the scripted backend, this works.
But the networkd backend generates the following 40-eth0.network file:

    [Match]
    Name=eth0

    [Network]
    DHCP=no
    IPv6PrivacyExtensions=kernel

This is happening because the wakeOnLan configuration creates a key in
networking.interfaces, and the networkd backend erroneously checks that
instead of for explicitly configured IP addresses as in the scripted
backend. The documentation is also inconsistent across various options.

This change aligns the networkd backend and option documentation to the
actual behavior of the scripted backend, and updates a test to account
for this behavior for both backends.
2023-10-14 13:57:32 -04:00
Majiir Paktu
c3e90f5667 nixos/network-interfaces-systemd: require defaultGateway.interface
The logic for configuring a gateway without an interface specified adds
a route with Gateway= to *every interface* configured by NixOS for
networkd. This leads to nonsensical configurations like the following:

    [Network]
    DHCP=no
    Address=192.168.0.1/24

    [Route]
    Gateway=10.0.0.1
    GatewayOnLink=false

We remove this logic and make defaultGateway.interface required to
configure a default gateway when using networkd.

We can ignore the removal of GatewayOnLink because systemd defaults it
to "no" anyway.
2023-10-07 16:09:11 -04:00
ajs124
1690adc424 nixos/tests/networking/caseSensitiveRenaming: fix bash syntax
was introduced broken in 93502aa3b1
2023-08-04 14:38:08 +02:00
ajs124
799a69971e nixos/tests/networking: dhcpd -> kea
forgotten in 413d9d3864
2023-08-04 14:23:09 +02:00
rnhmjoj
ea0b4a694a
nixos/test/networking: test unusual interface names 2023-05-27 19:19:37 +02:00
Graham Dennis
93502aa3b1 nixos/qemu-vm: add option for named network interfaces
Adds a new option to the virtualisation modules that enables specifying explicitly named network interfaces in QEMU VMs.
The existing `virtualisation.vlans` option is still supported for cases where the name of the network interface is irrelevant.
2023-05-24 08:54:20 +10:00
Vladimír Čunát
23ce77d76e Revert #178290: nixos/virtualisation: add option
...for explicitly named network interfaces

This reverts commit 6ae3e7695e.
(and evaluation fixups 08d26bbb72 7aed90a969)
Some of the tests fail or time out after the merge.
2023-01-30 07:55:50 -08:00
Raphael Robatsch
7aed90a969 nixos/tests/networking: fix evaluation
Fixes commands such as `nix-build -A nixosTests.networking.scripted`.
Currently this fails: "error: The option `nodes' is used but not
defined."
2023-01-29 14:30:29 +01:00
Vladimír Čunát
08d26bbb72
nixos/tests/networking.nix: hotfix evaluation
It broke by merge 8803f1da6.
2023-01-28 09:34:11 +01:00
Andrew Hoff
6ae3e7695e nixos/virtualisation: add option for explicitly named network interfaces
Adds a new option to the virtualisation modules that enables specifying
explicitly named network interfaces in QEMU VMs. The existing
`virtualisation.vlans` is still supported for cases where the name of
the network interface is irrelevant.
2023-01-22 12:20:40 -05:00
Philippe Schaaf
df52d556bb wip: add vlan-ping test
Signed-off-by: Philippe Schaaf <philippe.schaaf@secunet.com>
2022-07-21 16:19:20 +02:00
pennae
da28b26d64 nixos/networking: fix v4+v6 default gateways with networkd
fixes #178078
2022-06-18 09:33:35 +02:00
Alexandru Scvortov
3a09010b9d nixos/network-interfaces: add networking.interfaces.<name>.ipv[46].routes.type 2022-06-02 19:16:25 +01:00
Maximilian Bosch
b08a06859c
nixos/tests/networking/dhcpDefault: actually use networkd for client 2022-04-30 00:30:04 +02:00
Maximilian Bosch
161dd27ee1
nixos/tests/networking: test connectivity from both client & router 2022-04-30 00:30:02 +02:00
Linus Heckemann
ba4a615da9
nixos/tests/networking: add test for global useDHCP 2022-04-30 00:30:02 +02:00
Janne Heß
7024b4e5e3
nixos/udev: Put all initrd options into a namespace 2022-04-12 20:06:13 +01:00
Robert Hensing
aa0f27abb0 treewide: machine -> nodes.machine 2022-03-28 14:11:58 +02:00
jpathy
19bb72c070 networking.greTunnels: Add ttl option 2022-03-23 00:24:44 +05:30
jpathy
0a62de4cd5 networking.greTunnels: support ip6gre* 2022-03-17 17:59:36 +05:30
Martin Weinelt
60225c6bbd
nixos/tests/networking: Fix link test
The test was looking at the wrong interface and relying on silly
behaviour by the dummy driver, which autocreated a `dummy0` interface on
modprobe.

Fix this by making it look at the actual `foo` interface that the test
creates.
2022-02-24 23:11:13 +01:00
Martin Weinelt
b4ac004d09
nixos/test/networking: test bonding netdev creation
Previously the bonding driver would create an initial `bond0` interface
when it was loaded. If the network management integration used that
interface and did not recreate it, it was stuck to the default
`balance-rr` mode.

Deploying systemds modprobe.d configuration sets `max_bonds=0`, so we
don't run into that issue anymore.

Hence we now make sure that we can indeed create `bond0` with `802.3ad`
(LACP), which is a non default mode.
2022-02-22 17:29:41 +01:00
Luflosi
ca58bd0a50
nixos/networkd: Add routes from interfaces to [Route] section of .network file
Closes https://github.com/NixOS/nixpkgs/pull/93635.
2022-01-20 20:14:55 +01:00
Matthew Leach
5ce7061945 nixos/networking: add options for configuring a GRE tunnel
Add `networking.greTunnels` option that allows a GRE tunnel to be
configured in NixOS.
2021-12-07 15:44:00 +00:00
pennae
c1f5155471 nixos/networking: support FOU encapsulation for sits 2021-10-16 20:48:03 -04:00
pennae
f29ea2d15d nixos/networking: add foo-over-udp endpoint support
allows configuration of foo-over-udp decapsulation endpoints. sadly networkd
seems to lack the features necessary to support local and peer address
configuration, so those are only supported when using scripted configuration.
2021-10-16 20:48:03 -04:00
rnhmjoj
b29c2f97c3
nixos/lib/qemu-flags: rename to qemu-common
The current name is misleading: it doesn't contain cli arguments,
but several constants and utility functions related to qemu.
This commit also removes the use of `with import ...` for clarity.
2021-09-18 16:58:16 +02:00
John Whitman
8d3527aa88 nixos/network-interfaces: Fix wlan interface mac 2021-09-01 21:46:26 -04:00
aszlig
c066cc3c0b
nixos/tests/networking: Fix str literal comparison
Linter error:

  use ==/!= to compare constant literals (str, bytes, int, float, tuple)

Signed-off-by: aszlig <aszlig@nix.build>
2021-05-09 02:28:20 +02:00
Michele Guerini Rocco
19d715c573
Merge pull request #107382 from rnhmjoj/no-udev-settle
nixos/{networkd,dhcpcd}: remove udev-settle hack
2021-02-20 20:49:19 +01:00
rnhmjoj
7384c81e98
nixos/tests/networking: test interface renaming 2021-02-19 09:26:14 +01:00
Andrey Golovizin
1f3c9fd0ef nixos/tests/networking: fix DHCP range
Exclude static 192.168.*.2 addresses from the dynamic address range to
prevent different interfaces from getting the same address.

Seems like configuring a fixed IPv4 address does not automatically
exclude it from the dynamic address range.

Should fix occasional failures of
nixos.tests.networking.scripted.macvlan and possibly other networking
tests relying on DHCP.
2021-02-10 20:33:49 +01:00
Sarah Brofeldt
2e4d714334 nixos/tests/networking: Alleviate race in scripted test 2020-11-25 20:08:03 +01:00
Charlotte Van Petegem
8eca34dd16 nixos/tests/networking: fix macvlan tests
The range option still needs to be defined in dhcpd4 to be able to give out static IP addresses
2020-07-26 12:44:05 +02:00
Bas van Dijk
e15815e885 nixos/tests/networking.nix: test the services.dhcpd4.machines option
This modifies the `router` to not give out a range of IP addresses but
only give out a fixed address based on the MAC address using the
`services.dhcpd4.machines` option.

To get access to the MAC address the `qemuNicMac` function is defined
and exported from `qemu-flags.nix`.
2020-07-20 13:09:27 +02:00
Florian Klink
d1edd8b2f6 nixosTests.networking: test setting MTU and MAC Address
Both the scripted and networkd backend now support setting MTU and MAC
Address, so do this in a test to ensure it doesn't break.
2020-04-13 22:03:35 +02:00
Florian Klink
5150378c2f nixosTests.networking.virtual: fix with networkd
We only need to wait for network.target to get up, and the
network-addresses-${interfaceName} units are scripted networking only.
2020-04-13 22:03:35 +02:00
Florian Klink
1e1945319c nixosTests.networking: make routing table comparison more reliable
This was whitespace-sensitive, kept fighting with my editor and broke
the tests easily. To fix this, let python convert the output to
individual lines, and strip whitespace from them before comparing.
2020-04-13 22:03:35 +02:00
Florian Klink
355c58e485 nixos/networkd: respect systemd.network.links also with disabled systemd-networkd
This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.

This was originally applied in 36ef112a47,
but was reverted due to 1115959a8d causing
evaluation errors on hydra.
2020-03-19 14:15:32 +01:00
Vladimír Čunát
0729b8c55e
Revert Merge #82310: nixos/systemd: apply .link
...even when networkd is disabled

This reverts commit ce78f3ac70, reversing
changes made to dc34da0755.

I'm sorry; Hydra has been unable to evaluate, always returning
> error: unexpected EOF reading a line
and I've been unable to reproduce the problem locally.  Bisecting
pointed to this merge, but I still can't see what exactly was wrong.
2020-03-13 22:05:33 +01:00
Florian Klink
36ef112a47 nixos/networkd: respect systemd.network.links also with disabled systemd-networkd
This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.
2020-03-11 10:21:37 +01:00
Félix Baylac-Jacqué
1115959a8d tests/networking: remove pkgs.lib usages. 2020-03-11 10:21:37 +01:00
rnhmjoj
1d9538d77a
nixos/tests/networking: use new tempAddress option 2020-02-01 11:38:40 +01:00
Christian Kampka
98d562f0b3
nixosTests.networking: Port tests to python 2019-12-17 11:22:28 +01:00
Linus Heckemann
a3a441cd87 nixos/tests/{ferm,networking}: fix eval with networkd
The networking.virtual test does not work with networkd yet, for
multiple reasons:

- network-online.target is not reached, because tun0 and tap0 are
  considered as required for online but _not_ brought up or assigned
  the configured addresses
- the commands later in the test rely on some units from the scripted
  network setup

cc @fpletz networkd exper
cc @globin we looked at this together
2019-10-08 17:14:26 +02:00
Robin Gloster
c26c6241ea
networking.useDHCP: disallow for networkd
This setting will be removed with the switch to systemd-networkd. The
use of per interface config is encouraged instead.
2019-09-24 10:20:16 +02:00
Frederik Rietdijk
5061fe0c2c Merge staging-next into staging 2019-08-28 08:26:42 +02:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00