ubuntu18.04设置静态IP

添加网卡配置

sudo vim /etc/netplan/01-network-manager-all.yaml
network:
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.8.166/24]
      gateway4: 192.168.8.1
      nameservers:
        addresses:
        - 192.168.8.1
        - 8.8.8.8
        - 114.114.114.114
  version: 2
  renderer: networkd
sudo netplan apply

双网卡配置

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: true
    ens34:
      addresses:
      - 192.168.241.129/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 144.144.144.144
        search:
        - local
  version: 2
posted @ 2021-11-19 21:48  GreeneGe  阅读(53)  评论(0编辑  收藏  举报

https://github.com/Glf9832