Skip to content
Apr 28 / Greg

Add Secondary IP Address to Centos Interface

This is super simple, just create a new interface file with a colon and a number.

/etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
IPADDR=192.168.0.5
ONBOOT=yes

6 Comments

leave a comment
  1. A. Ginting / Mar 12 2010

    To activate it, just

    # ifup eth0:1

    Thanks

  2. pingo / May 28 2010

    thanks , ifconfig eth0:1 x.x.x.x/24 up

  3. Greg / May 28 2010

    NP

  4. Dean / Jan 8 2013

    Im not sure if its only since CentOS 6, but you can also just add ‘IPADDR2′ to ifcfg-eth0.
    So there is no need to add ifcfg-eth0:0
    But perhaps there are other advantages of doing so.

    But this also works, the server will listen on this IP too.

    E.G, add this to the bottom of ifcfg-eth0
    IPADDR2=192.168.1.2
    PREFIX2=24

  5. Greg / Jan 8 2013

    @Dean
    Thanks for the update!

  6. Peter / Jan 25 2013

    Thank you !!!!!!!!!!!!!

Leave a Comment

*