Skip to content

Instantly share code, notes, and snippets.

@arupgsh
Last active October 27, 2021 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arupgsh/0eb07105fba3e74f74442b30460e549b to your computer and use it in GitHub Desktop.
Save arupgsh/0eb07105fba3e74f74442b30460e549b to your computer and use it in GitHub Desktop.
Netplan routing configuration (IPV4) for dual networking interfaces, with one having access to internet other only accessible via local network. This has been tested in Ubuntu server 20.04 and for some reason netplan apply works although netplan try is not working.
# Last update 27-10-2021
# network scheme was create using https://netplan.io/reference/
# The following configuration assumes the first interface has internet access
# CIDR calculator https://mxtoolbox.com/subnetcalculator.aspx
network:
ethernets:
eno1:
addresses:
- xxx.xxx.xxx.xxx/24 #IPV4 address for interface 1
routes:
- to: default
via: xxx.xxx.xxx.xxx #gateway ip for interface 1
metric: 3
routing-policy:
- to: 0.0.0.0/0
from: xxx.xxx.xxx.xxx/24 #IPV4 address for interface 1
priority: 100
link-local: []
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
eno2:
addresses:
- xxx.xxx.xxx.xxx/24 #IPV4 address for interface 2
routes:
- to: default
via: xxx.xxx.xxx.xxx #gateway IPV4 address for interface 2
metric: 6
routing-policy:
- to: 0.0.0.0/0
from: xxx.xxx.xxx.xxx/24 #IPV4 address for interface 2
priority: 200
link-local: []
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
version: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment