Table of Contents

ubuntu and variants

Netplan

Netplan is a front end for systemd-networkd

Example Netplan yaml file to create a bridge

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.)

Sharing Internet with an interface

#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

Configure isc-dhcp-server

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;
}