Wired Connection → IPv4 Settings → Routes → Use this connection only for resources on its network. (source)cat /sys/class/net/<interface>/speednethogs. Add the -C option to nethogs to see both UDP and TCP (shows only TCP by default)
Netplan is a front end for systemd-networkd
systemd restart systemd-networkd.servicenetplan try/etc/netplanNetwork Manager as renderer for GUI, or networkd to configure inside the YAML filenetwork:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
eno1:
dhcp4: no
enxf8e43b6c9b8c:
dhcp4: true
bridges:
br2:
dhcp4: no
addresses:
- 10.42.0.1/24
interfaces:
- enp1s0
- eno1
With this configuration you can treat br2 as if it were a real physical interface (run a DHCP server on it, etc.)
sudo echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward/etc/sysctl.confenxf8e43b6c9b8c connects to the internet and br2 is the interface you wish to share internet with#iptables -t nat -A POSTROUTING -o enxf8e43b6c9b8c -j MASQUERADE #iptables -A FORWARD -i enxf8e43b6c9b8c -o br2 -m state --state RELATED,ESTABLISHED -j ACCEPT #iptables -A FORWARD -i br2 -o enxf8e43b6c9b8c -j ACCEPT
iptables-persistent to retain iptables rules on reboot./etc/default/isc-dhcp-server set the interface.INTERFACESv4="br2"/etc/dhcp/dhcpd.confddns-update-style none;
authoritative;
default-lease-time 600;
max-lease-time 7200;
subnet 10.42.0.0 netmask 255.255.255.0 {
range 10.42.0.50 10.42.0.254;
option routers 10.42.0.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}