美文网首页
Ubuntu配置静态IP

Ubuntu配置静态IP

作者: 浪漫矢志不渝 | 来源:发表于2021-12-18 10:31 被阅读0次

ubuntu14/16
vi /etc/network/interfaces

#注释dhcp配置模式
#auto ens33
#iface ens33 inet dhcp

#配置static配置模式
auto ens33#网卡
iface ens33 inet static#配置模式
address 10.0.10.26#静态IP地址
netmask 255.255.255.0#子网掩码
gateway 10.0.10.1#网关(重要)
dns-nameserver 8.8.8.8#DNS解析(重要)

sudo systemctl restart networking.service 或者/etc/init.d/networking restart
ubuntu18/20
vi /etc/netplan/配置文件 例如 vi /etc/netplan/50-cloud-init.yaml

network:
    version: 2
    ethernets:
        ens33:
            dhcp4: no
            addresses: [192.168.1.100/24]
            optional: true
            gateway4: 192.168.1.1
            nameservers:
                    addresses: [223.5.5.5,223.6.6.6]
    

sudo netplan apply 配置应用
ip addr 或者ifconfig 查看ip

相关文章

网友评论

      本文标题:Ubuntu配置静态IP

      本文链接:https://www.haomeiwen.com/subject/ldxgfrtx.html