Home  >  Article  >  System Tutorial  >  How to add local loopback address on CentOS7?

How to add local loopback address on CentOS7?

WBOY
WBOYforward
2024-01-13 20:00:051206browse

1、临时添加

ip addr add 10.10.1.1/32 dev lo:1

重启失效

2、永久添加

cd /etc/sysconfig/network-scripts

cp ifcfg-lo ifcfg-lo:1

[root@localhost network-scripts]# cat ifcfg-lo:1

DEVICE=lo:1

IPADDR=10.10.1.1

NETMASK=255.255.255.255

ONBOOT=yes

NAME=loopback1

[root@localhost network-scripts]# ip addr

1: lo: mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet 10.10.1.1/32 brd 10.10.1.1 scope global lo:1

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

[root@localhost network-scripts]# ping -c1 10.10.1.1

PING 10.10.1.1 (10.10.1.1) 56(84) bytes of data.

64 bytes from 10.10.1.1: icmp_seq=1 ttl=64 time=0.045 ms

The above is the detailed content of How to add local loopback address on CentOS7?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete