Lanyiyun: Ubuntu Server 22.04 Configuring Static IP Tutorial

The tutorial for configuring static IP on Ubuntu Server 22.04 is as follows:

  1. Edit network configuration file:

    • Execute the following command to edit the network configuration file:

      sudo vi /etc/netplan/00-installer-config.yaml
  2. Configure static IP:

    • In the edited file, add the following to configure the static IP:

      network:
          version: 2
          renderer: networkd
          ethernets:
              ens33:  # 根据实际网络接口名称修改
                  dhcp4: no
                  addresses: [192.168.1.100/24]  # 根据实际IP地址和子网掩码修改
                  gateway4: 192.168.1.1  # 根据实际网关IP地址修改
                  nameservers:
                      addresses: [8.8.8.8, 8.8.4.4]  # 根据实际DNS服务器IP地址修改
    • According to actual needs and network environment, modify the interface name (ens33), IP address, subnet mask, gateway and DNS server address in the above configuration.
  3. Save and close the file.
  4. Apply network configuration:

    • Execute the following command to apply the network configuration:

      sudo netplan apply
  5. Restart the network service:

    • Execute the following command to restart the network service to make the static IP take effect:

      sudo systemctl restart systemd-networkd

Through the above steps, you can configure a static IP on Ubuntu Server 22.04. Please modify the parameters in the configuration file according to the actual network environment and needs to ensure that the configuration is correct. After applying the network configuration and restarting the network service, the system will use the specified static IP address for network communication.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/132945608