CentOS7如何添加本地回环地址?CentOS7添加本地回环
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: <LOOPBACK,UP,LOWER_UP> 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