Page:
Service:netplan
Pages
修改成台北時區
將PCIe直通給PVE的虛擬機
延展系統硬碟
憑證 x509 問題
進入 busybox 問題
53 埠被占用
Claude:ccstatusline
Database:PostgreSQL
Database:SQLServer
Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block
Service:ASP.NET
Service:CLIProxyAPI
Service:Coder
Service:Docker
Service:ElasticSearch
Service:Emby
Service:Gitea
Service:GiteaRunner
Service:Gitlab
Service:MeTube
Service:OpenClaw
Service:OpenCode
Service:PicoClaw
Service:Redis
Service:Traefik
Service:VS Code
Service:Vaultwarden
Service:ezBookkeeping
Service:k3d
Service:netplan
Tool:常用
Tool:C# SDK
Tool:Node JS
Tool:Oh My Posh
Clone
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
簡介
netplan 是 Ubuntu 的網路設定工具,以 YAML 描述網路介面。本文記錄多網卡環境下,透過路由權重(metric)控制預設對外流量走哪張網卡的設定範例。metric 數值越小優先權越高。
設定檔通常位於 /etc/netplan/,修改後以 netplan apply 套用。
多網路權重設定
雙 DHCP
兩張網卡都使用 DHCP,透過 route-metric 讓 eth1(100)優先於 eth0(200)作為對外路由。
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
route-metric: 200
eth1:
dhcp4: true
dhcp4-overrides:
route-metric: 100
靜態 + 動態
ens18 使用靜態 IP(metric 200),ens19 使用 DHCP(metric 100),對外流量優先走 metric 較小的 ens19。
network:
version: 2
ethernets:
ens18:
addresses:
- "172.25.43.200/20"
nameservers:
addresses:
- 168.95.1.1
- 8.8.8.8
search: []
routes:
- to: "0.0.0.0/0"
via: "172.25.32.1"
metric: 200
ens19:
dhcp4: true
routes:
- to: "0.0.0.0/0"
metric: 100