Home > Computer Tutorials > Computer Knowledge > How to set a fixed IP address on Ubuntu 22.04 system.

How to set a fixed IP address on Ubuntu 22.04 system.

WBOY
Release: 2024-02-20 08:30:03
forward
797 people have browsed it

Ubuntu 22.04系统如何设置固定IP地址。

To set a fixed IP address on Ubuntu 22.04, you can follow the steps below:

  1. Open the terminal and edit the network configuration file with administrator privileges:

    sudo nano /etc/netplan/00-installer-config.yaml
    Copy after login
  2. In the file, you will see a configuration similar to:

    network:
      ethernets:
        enp0s3:
          dhcp4: true
      version: 2
    Copy after login
  3. Will
    dhcp4: true modified to
    dhcp4: no, to disable DHCP and enable manual configuration.
  4. Add static IP address configuration, for example:

    network:
      ethernets:
        enp0s3:
          addresses: [192.168.0.100/24]
          gateway4: 192.168.0.1
          nameservers:
            addresses: [8.8.8.8, 8.8.4.4]
      version: 2
    Copy after login

    Replace
    enp0s3 with your network interface name. Specify the fixed IP address, subnet mask, gateway and DNS server address you want to use.

  5. Save changes and close file.
  6. Apply new network configuration:

    sudo netplan apply
    Copy after login
  7. Restart network service:

    sudo systemctl restart systemd-networkd
    Copy after login

After completing the above steps, your Ubuntu 22.04 system will use the fixed IP address you specified for network connection. Please ensure that the selected IP address does not conflict with other devices on the network and is configured appropriately according to your network environment.

Please note that depending on the Ubuntu version and network management tool you are using, the location and naming of the network configuration file may change, and corresponding adjustments may be required.

The above is the detailed content of How to set a fixed IP address on Ubuntu 22.04 system.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template