1. 程式人生 > >Ubuntu18.04的網路管理netplan

Ubuntu18.04的網路管理netplan

Ubuntu18.04使用的網路管理是netplan, 配置檔案在/etc/netplan/下

剛安裝完成的配置是這樣的

剛安裝完成的配置是這樣的
network:
    ethernets:
        ens3:
            addresses:
            - 192.168.13.25/24
            dhcp4: false
            gateway4: 192.168.13.1
            nameservers:
                addresses:
                - 114.114.114.114
                search: []
    version: 2

.新增靜態路由

network:
    ethernets:
        ens3:
            addresses:
            - 192.168.13.25/24
            dhcp4: false
            gateway4: 192.168.13.1
            nameservers:
                addresses:
                - 114.114.114.114
                search: []
            routes:
            - to: 10.8.0.0/24
              via: 192.168.13.15
    version: 2

.