ubuntu 18.04 netplan source routing

Hi

Here a source routing example if you have multiple networks connected on your linux host and want every ip address reachable on the internet.

network:
   version: 2
   renderer: networkd
   ethernets:
     ens3:
       dhcp4: no
       dhcp6: no
       accept-ra: no
       addresses: [81.94.xx.xx/28, "2a01:xxx:xxxx:xx::xx/64"]
       gateway4: 81.94.xx.xx
       gateway6: 2a01:xxx:xxxx:xx::x
       nameservers:
         addresses: [1.0.0.1]
     ens6:
       dhcp4: no
       dhcp6: no
       accept-ra: no
       addresses: [195.16.xxx.111/25]
       routes:
         - to: 195.16.xxx.x/25
           via: 195.16.xxx.gw
           table: 102
         - to: 0.0.0.0/0
           via: 195.16.xxx.gw
           table: 102
       routing-policy:
         - from: 195.16.xxx.111
           table: 102
         - to: 195.16.xxx.111
           table: 102

Have fun!

Ubuntu 18.04 Network Configuration ipv4 ipv6 Dual Stack

Hi

no /etc/network/interfaces ?

Let’s go for it :-)

vim /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no
      accept-ra: no
      addresses: [192.168.1.2/24, "XXXX:XXXX:XXXX:XXXX::2/64"]
      gateway4: 192.168.1.1
      gateway6: XXXX:XXXX:XXXX:XXXX::1
      nameservers:
        addresses: [1.1.1.1, 1.0.0.1]

here a bridged example

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no
      accept-ra: no
  bridges:
    br0:
      interfaces: [eno1]
      dhcp4: no
      dhcp6: no
      accept-ra: no
      addresses: [192.168.1.2/24, "XXXX:XXXX:XXXX:XXXX::2/64"]
      gateway4: 192.168.1.1
      gateway6: XXXX:XXXX:XXXX:XXXX::1
      nameservers:
        addresses: [1.1.1.1, 1.0.0.1]

here a bridged example with vlans

network:
  version: 2
  renderer: networkd
  ethernets:
    enp5s0f0:
      dhcp4: no
      dhcp6: no
      accept-ra: no
  vlans:
    vlan302:
      id: 302
      link: enp5s0f0
      dhcp4: no
      dhcp6: no
      accept-ra: no
    vlan412:
      id: 412
      link: enp5s0f0
      dhcp4: no
      dhcp6: no
      accept-ra: no
  bridges:
    br0:
      interfaces: [vlan302]
      dhcp4: no
      dhcp6: no
      accept-ra: no
      addresses: [1.1.1.2/24]
      gateway4: 1.1.1.1
      nameservers:
        addresses: [1.1.1.1, 1.0.0.1]
    br1:
      interfaces: [vlan412]
      dhcp4: no
      dhcp6: no
      accept-ra: no

the spaces are mandatory!

Have fun