64 Commits

Author SHA1 Message Date
Timmy Welch
fdc36b64ef Merge remote-tracking branch 'github/master' 2025-01-31 21:55:15 -08:00
Michael Stapelberg
13e1c1bbb4 netconfig: move /tmp/resolv.conf symlink out of the way
Commit 0f75b1cbef6d0ec4853a6a02d96d4b57ce478769 was incomplete.
2025-01-27 08:26:03 +01:00
Michael Stapelberg
0f75b1cbef netconfigd: write /tmp/resolv.conf only once, do not clobber
This fixes tailscale name resolution breaking again and again.
2025-01-26 10:16:38 +01:00
Michael Stapelberg
07325dde93 netconfigd: do not hardcode 10.0.0.0/24 netmask for hairpinning
related to https://github.com/rtr7/router7/issues/53
2025-01-12 10:29:42 +01:00
Timmy Welch
fc2e21cfd6 Fix nft run 2024-12-24 11:09:11 -08:00
Timmy Welch
ab82f05a21 Merge remote-tracking branch 'github/master' 2024-05-25 19:00:45 -07:00
Michael Stapelberg
f835cdf1d6 netconfig: do not re-create nftables ruleset from scratch
The current behavior stomps on the rules that programs like
podman or tailscale set up for port forwarding.

With this change, we split port forwardings into a separate chain,
which allows us to create the ruleset once at startup and then only
update the port forwardings specifically (the only dynamic part
of router7’s nftables ruleset).
2024-05-09 10:06:23 +02:00
Timmy Welch
bf58d46748 Merge remote-tracking branch 'github/master' 2024-01-20 11:49:11 -08:00
Timmy Welch
ab5bce1356 updates 2024-01-20 11:41:04 -08:00
Timmy Welch
996061b126 Merge remote-tracking branch 'github/master' 2023-09-23 17:56:39 -07:00
Michael Stapelberg
196e3f9fd7 netconfig: make forward error correction (FEC) configurable 2022-08-30 21:58:55 +02:00
Michael Stapelberg
db15477448 disable icmp ratelimit
Otherwise, traceroute mysteriously times out sometimes.

https://twitter.com/zekjur/status/924248132837347330
2022-06-21 18:30:53 +02:00
Michael Stapelberg
ce66287189 netconfig: make the MTU configurable
Just in case we need to set it on an uplink0 interface at some point, for example.
2022-06-15 23:19:43 +02:00
Michael Stapelberg
f4dd972e54 netconfig: WireGuard: set up host routes instead of DHCP default
related to https://github.com/rtr7/router7/issues/52
2022-06-07 23:22:08 +02:00
Michael Stapelberg
7d936f4844 allow configuring extra routes
Useful for routing IPv6 subnets through a WireGuard tunnel.

related to https://github.com/rtr7/router7/issues/52
2022-06-06 14:25:25 +02:00
Michael Stapelberg
f52deeed03 allow configuring extra addresses on interfaces
Useful when you need IPv6 and IPv4 addresses on a WireGuard tunnel.
2022-06-06 14:25:25 +02:00
Michael Stapelberg
593cd8c12d export input/output nftables counters as well as forwarded
Thus far, we have only had forwarded bytes metrics.

Notably, forwarded bytes does not include bytes that were sent by the router
itself, e.g. by the webserver or rsync server running on the machine.

fixes https://github.com/rtr7/router7/issues/71
2022-03-08 22:47:18 +01:00
Michael Stapelberg
8dc93c66c4 netconfig: enable NAT hairpinning for port forwardings
fixes https://github.com/rtr7/router7/issues/53
2022-03-08 09:32:09 +01:00
lordwelch
67711ee2c7 Merge branch 'master' of https://github.com/rtr7/router7 2022-03-04 13:30:38 -08:00
Michael Stapelberg
b88ddd41c3 netconfig: don’t try to add bridge to itself 2021-06-12 22:24:38 +02:00
Michael Stapelberg
bfb94377f4 netconfig: move bridge creation into its own function
also don’t short-circuit the rest of the configuration if bridge config fails
2021-06-12 18:25:37 +02:00
Michael Stapelberg
cffd872346 netconfig: implement bridge configuration
fixes https://github.com/rtr7/router7/issues/65
2021-06-06 15:43:55 +02:00
lordwelch
ef50f7c2e4 Merge remote-tracking branch 'origin/master' 2021-03-15 22:44:39 -07:00
Michael Stapelberg
876f8e320f netconfig: de-configure old DHCPv4 addresses from uplink0
It is generally not a good idea to have multiple IP addresses on the same
interface unless managing their relative priorities via metrics etc.

During an outage, I noticed that with multiple IP addresses,
Linux was using the old obsolete one to send out packets,
which does not work with the ISP.

With this change,
we still hold on to IP addresses for as long as possible,
but no longer.

fixes issue #57
2020-09-12 19:58:47 +02:00
lordwelch
3c451f06ca Add the ability to run router7 on a normal Linux distribution 2020-08-10 18:12:34 -07:00
Matt Layher
61174cde06
internal/netconfig: add missing error check
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-09 17:04:31 -04:00
Michael Stapelberg
dba1dad718 wireguard: switch to wgctrl package
related to #14
2020-02-16 00:15:23 +01:00
Michael Stapelberg
bfba9f17af netconfigd: collect all errors but keep going 2020-02-15 23:38:37 +01:00
Michael Stapelberg
96b626897a netconfigd: work not only with uplink0, but also eth0 and ens3
This makes it possible to use netconfigd on gokrazy Raspberry Pi installations.
2020-02-15 23:37:29 +01:00
Michael Stapelberg
ef60a01f3f netconfigd: continue if interfaces.json does not exist 2020-02-15 23:35:51 +01:00
Michael Stapelberg
3dad1e9a23 dhcp4: use the configured (not the current) MAC address
This fixes a race where dhcp4 started before netconfigd had a chance to change
the hardware address on the uplink0 interface.

fiber7’s port security feature may result in an about hour-long internet outage
without this commit.
2019-02-19 09:39:16 +01:00
Michael Stapelberg
8df6329209 use renameio to write files atomically 2019-01-06 15:25:33 +01:00
Michael Stapelberg
725262d376 netconfig: use sysctl format for easier copy&paste 2018-12-25 14:08:14 +01:00
Michael Stapelberg
ec4f1f4dc5 netconfig: implement WireGuard support
To set up a tunnel, create a /perm/wireguard.json as illustrated in
netconfig_test.go, and don’t forget to adjust your /perm/interfaces.json with
the address configuration for the WireGuard tunnel.

Note that static routes cannot currently be configured, so the usefulness is
limited. If you have a use-case you’d like to see covered, please explain it in
https://github.com/rtr7/router7/issues/14
2018-11-26 18:29:03 +01:00
Michael Stapelberg
2e8e0daa0a implement TCP MSS clamping (for non-ethernet uplinks)
We didn’t have a need to clamp the TCP Maximum Segment Size (MSS) up until now,
because fiber7 uses an MTU of 1500.

Because Path MTU discovery is often broken on the internet, it’s best practice
to limit the Maximum Segment Size (MSS) of each TCP connection, achieving the
same effect (but only for TCP connections).

This change is beneficial when running router7 behind a non-ethernet uplink,
such as a Fritz!Box cable modem.

This has no adverse effect on fiber7: after clamping, the MSS is still 1440, as
without clamping.
2018-10-22 18:54:25 +02:00
Michael Stapelberg
b03596f1c5 nftables: use stateful object counters
This way, we can atomically get and reset them.

fixes https://github.com/rtr7/router7/issues/3
2018-08-08 23:15:21 +02:00
Michael Stapelberg
daa14845ab netconfig: plug fd leak by closing the netlink handle
fixes #4
2018-07-22 23:07:23 +02:00
Michael Stapelberg
3282dc5675 netconfig: GetRule filtering is not supported by Linux 4.4.0 (trusty) 2018-07-14 20:53:15 +02:00
Michael Stapelberg
b347ed74c5 update import paths 2018-07-09 08:54:04 +02:00
Michael Stapelberg
ff7aa8f2cb add copyright notices 2018-06-28 20:08:23 +02:00
Michael Stapelberg
2b3cf0bf61 captured: use multilisten 2018-06-28 20:08:23 +02:00
Michael Stapelberg
4c7741a337 add backupd 2018-06-26 18:01:50 +02:00
Michael Stapelberg
60de127991 Describe all packages and binaries. 2018-06-25 20:12:51 +02:00
Michael Stapelberg
3886367a32 remove TODOs: the sysctls have reasonable defaults 2018-06-23 20:34:42 +02:00
Michael Stapelberg
bf2c12a69d netconfigd: export ipv4/ipv6 packet/bytes counters on :8066 2018-06-23 19:56:34 +02:00
Michael Stapelberg
37bf17e1b7 make binaries cope with Squashfs root 2018-06-22 17:59:23 +02:00
Michael Stapelberg
24e2d5de00 dnsd: serve prometheus metrics on port 8053 2018-06-18 08:04:56 +02:00
Michael Stapelberg
0e6add220c notify dyndns from netconfigd, i.e. _after_ applying addresses 2018-06-17 20:44:25 +02:00
Michael Stapelberg
a1c4d60666 netconfig: implement support for port ranges 2018-06-14 22:25:39 +02:00
Michael Stapelberg
390c2af7db netconfig: implement UDP port forwardings 2018-06-14 21:05:43 +02:00