Home System Tutorial LINUX How to add IP address in CentOS

How to add IP address in CentOS

Jan 05, 2024 pm 08:37 PM
centos add ip

Generally we can add a new IP to the eth0 network card

cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0:1
vim ifcfg-eth0:1
DEVICE=eth0:1 # 修改网卡名称
HWADDR=29:61:16:5B:29:7C
TYPE=Ethernet
UUID=bf14538c-a6cf-4fd3-b459-e4db69437c2e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.203
NETMASK=255.255.255.192
GATEWAY=xxx.xxx.xx.xxx
DNS1=8.8.8.8
Copy after login

Save and exit and then start the network card:

ifup eth0:1
Copy after login

Then you can use the ip addr command to check whether the addition is successful
Bonus: Delete the specified ip on the network card

ip addr del 192.168.0.1 dev eth0 # 删除网卡的第二个IP地址
Copy after login

The above is the detailed content of How to add IP address in CentOS. For more information, please follow other related articles on the PHP Chinese website!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to input Chinese in centos How to input Chinese in centos Apr 07, 2024 pm 08:21 PM

How to input Chinese in centos

How to read USB disk files in centos7 How to read USB disk files in centos7 Apr 07, 2024 pm 08:18 PM

How to read USB disk files in centos7

How to enter root permissions in centos7 How to enter root permissions in centos7 Apr 02, 2024 pm 08:57 PM

How to enter root permissions in centos7

What to do if you forget your password to log in to centos What to do if you forget your password to log in to centos Apr 07, 2024 pm 07:33 PM

What to do if you forget your password to log in to centos

SCP usage tips-recursively exclude files SCP usage tips-recursively exclude files Apr 22, 2024 am 09:04 AM

SCP usage tips-recursively exclude files

What should I do if I forget my centos username and password? What should I do if I forget my centos username and password? Apr 02, 2024 pm 08:54 PM

What should I do if I forget my centos username and password?

How to enable root permissions in centos7 How to enable root permissions in centos7 Apr 07, 2024 pm 08:03 PM

How to enable root permissions in centos7

What should I do if I forget my centos7 password? What should I do if I forget my centos7 password? Apr 02, 2024 pm 08:51 PM

What should I do if I forget my centos7 password?

See all articles