2019-01-23 Ubuntu 18.04網卡配置

Ubuntu18.04使用NetPlan工具用於配置網絡接口,16.04的配置文件是:/etc/network/interfaces,現在則需要編輯/etc/netplan/*.yaml文件來配置Ubuntu18.04的網絡參數。

貼一下配置文件內容:

root@THN:~/# vim /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens3:
            dhcp4: no
            dhcp6: no
            addresses:
            - 46.xxx.xxx.xx/28
            - 2A02:ABCD:1:2::2/64
            gateway4: 46.xxx.xxx.xx
            gateway6: 2A02:ABCD:1:2::1
            nameservers:
                addresses:
                - 8.8.8.8
                search: []
            optional: true
    version: 2

應用配置是:

root@THN:~/# netplan apply
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章