Configuring a Static IP on Linux by Netplan Configuration Template

  1. Configuration File (/etc/netplan/01-network-manager-all.yaml):
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
      eth0:
          dhcp4: no
          addresses:
              - xx.xx.xx.xx/xx
          routes:
            - to: default
              via: yy.yy.yy.yy
          nameservers:
              addresses:
                  - zz.zz.zz.zz
                  - aa.aa.aa.aa
                  - bb.bb.bb.bb

xx.xx.xx.xx/xx: the static IP address assigned to the network interface with subnet mask information

yy.yy.yy.yy: the IP address of the gateway

zz.zz.zz.zz: Primary DNS server

aa.aa.aa.aa: Secondary DNS server

bb.bb.bb.bb: Tertiary DNS server

2. apply netplan and then rebooot

sudo netplan apply

留下评论

通过 WordPress.com 设计一个这样的站点
从这里开始