Ubuntu Server 18.04 網絡設置不生效的解決


在Ubuntu18.04中,傳統的配置/etc/network/interfaces已無用https://www.cnblogs.com/dunitian/p/6658578.html

新方法:修改 /etc/netplan/50-cloud-init.yaml

 

配置如下:

network:
    ethernets:
        eth0:
            addresses: [192.168.36.202/24]
            gateway4: 192.168.36.1
            nameservers:
                    addresses: [114.114.114.114,180.76.76.76]
    version: 2


重啟網絡sudo netplan apply

 

 
        

 

如果網絡不正常可以使用:sudo netplan --debug apply

 

測試一下遠程連接

 

配置多個ip

# 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:

        enp1s0f0:

            addresses: [182.255.60.205/24,182.255.60.214/24,182.255.60.201/24]

            dhcp4: false

            gateway4: 182.255.60.254

            nameservers:

                addresses: [8.8.8.8,114.114.114.114]

                search: []

        enp1s0f1:

            addresses: []

            dhcp4: true

            optional: true

    version: 2

 

轉載於:

http://www.mamicode.com/info-detail-2459162.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM