I'm trying to alias an ip address onto Lo or create a new loopback interface such as lo:1

I've created /etc/sysconfig/network-scripts/ifcfg-lo:10


When I do ifup lo:10

[root@xxxx network-scripts]# ifup lo:10
Error: no device found for connection 'lo10'.

Can anyone please shed some light on this issue. I have used this method for aliasing ip addresses on physical interfaces without issues.

This is not a duplicate as Michael has tried to point out as I'm trying the correctly documented way and would rather not use the rc.local as suggested in what he feels the same question.

  • You already have a loopback interface. Why don't you just use it? – Michael Hampton Dec 18 '15 at 18:36
  • @MarkMcN, what if you change the line to NAME=lo:10 or remove the line? – Diamond Dec 18 '15 at 20:11
  • interface lo has the ip address, I need a second lo for a different ip – MarkMcN Dec 18 '15 at 20:45
  • @bangal Tried that and no difference – MarkMcN Dec 18 '15 at 21:13

The only way I have been able to get this to work is to issue a

systemctl network restart

Then you get this

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 scope host lo
       valid_lft forever preferred_lft forever
    inet brd scope global lo0:10

You can though just add an IP address to lo nd you don't need to create a new interface to do it.

ip addr add dev lo 

and you get this

    inet scope global lo
   valid_lft forever preferred_lft forever

On CentOS the ifup script contains this snipet

if [ -x /sbin/ifup-local ]; then
    /sbin/ifup-local ${DEVICE}

So you can create a file called /etc/sysconfig/network-scripts/ifup-local and have it do things for you once the interface is up

if [[ "$1" == "lo" ]]
  ip addr add dev lo
  # do something else  

Not the answer you're looking for? Browse other questions tagged or ask your own question.