关于 Ubuntu 18.04 的网络(dchp/dns)

【概述】

    Ubuntu Server 18.04 中用 netplan 取代了 ifupdown,配置文件在 /etc/netplan/ 目录下,文件格式为 yaml,使配置文件生效的命令为 sudo netplan apply


【典型配置】

network:
    ethernets:
		# 静态IP
        enp2s0:
            addresses:
            - 192.168.0.145/24
            gateway4: 192.168.0.1
            nameservers:
                addresses:
                - 223.5.5.5
                search: []
            optional: true
		# 动态IP
        enp4s0:
            addresses: []
            dhcp4: true
			# 若没有下面这一句
			# 向服务器发送的“mac”地址会是类似“5de26c1500020000ab1102df86200698a807”的奇怪字符串
			# 实际上这是 DUID
            dhcp-identifier: mac
            optional: true
            optional: true
    version: 2


*** walker ***


猜你喜欢

转载自blog.51cto.com/walkerqt/2121029