• give priority to Wi-Fi over Ethernet for Internet connections: Wired ConnectionIPv4 SettingsRoutesUse this connection only for resources on its network. (source)
  • check speed of NIC: cat /sys/class/net/<interface>/speed
  • check bandwidth of what is being sent in realtime with nethogs. 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

  • restarting netplan: systemd restart systemd-networkd.service
  • try and optionally use a new netplan config: netplan try
  • configuration are YAML files that go inside /etc/netplan
  • in the config file choose Network Manager as renderer for GUI, or networkd to configure inside the YAML file
network:
    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.)

  • configure the userspace to allow ipv4 forwarding:
    • temporary: sudo echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
    • persistant: change setting in /etc/sysctl.conf
  • assuming enxf8e43b6c9b8c 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
  • install iptables-persistent to retain iptables rules on reboot.

Configure isc-dhcp-server

  • inside /etc/default/isc-dhcp-server set the interface.
    • Assuming interface for dhcp server will be br2: INTERFACESv4="br2"
  • configuration goes inside /etc/dhcp/dhcpd.conf
    • Assuming interface for DHCP server is at 10.42.0.1, example config:
ddns-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;
}
  • lwc/networking/start.txt
  • Last modified: 2023/10/27 10:07
  • by 127.0.0.1