How to configure ip in centos

下次还敢
Release: 2024-04-07 21:00:25
Original
1146 people have browsed it

How to configure the IP address of the CentOS system

Method 1: Use the network manager

  • Open "System Settings"
  • Select "Network"
  • Select the network connection to configure
  • Click "Edit"
  • In the "IPv4 Settings" tab, select "Manual ”
  • Enter the required IP address, subnet mask and gateway
  • Click “Save”

Method 2: Using the command line

  • Use the following command to get the list of current network interfaces:

    <code>nmcli device status</code>
    Copy after login
  • Determine the network interface to configure (for example, enp0s3)
  • Configure the IP address using the following command:

    <code>nmcli con mod enp0s3 ipv4.addresses 192.168.1.10/24 gw4 192.168.1.1</code>
    Copy after login

    Where:

  • enp0s3 is replaced with the network interface
  • 192.168.1.10 is replaced with the desired IP address
  • 24 Replace with subnet mask
  • 192.168.1.1 Replace with gateway address

Other options

  • DHCP: If you want the system to obtain an IP address from a DHCP server, select the Automatic option in Network Manager.
  • Static IP: If you wish to manually assign an IP address, use one of the steps above.
  • Check the IP address: Check the assigned IP address using the following command:

    <code>ip a</code>
    Copy after login
  • Apply changes: After configuring the IP address, you need to apply the changes using the following command:

    <code>nmcli con up enp0s3</code>
    Copy after login

The above is the detailed content of How to configure ip in centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template