Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • How to assign an additional/alias IP addresses to a network card (NIC)?

    Posted on

    Hello folks,

    I'm looking for best practice to assign and manage an additional/alias IP addresses to a network card (NIC) in RHEL 7 and RHEL 8.

    Most of my network configurations for a host with a single NIC looks something like this:

    # cat /etc/sysconfig/network-scripts/ifcfg-ens192
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    IPV6_FAILURE_FATAL=no
    IPV6_PRIVACY=no
    NAME=ens192
    DEVICE=ens192
    ONBOOT=yes
    DNS1=192.168.0.1
    DNS2=192.168.0.2
    PEERDNS=no
    DOMAIN="foo.example.com example.com"
    IPADDR=192.168.3.56
    PREFIX=24
    GATEWAY=192.168.3.1
    

    Today when I have to add an additional IP address to this NIC I would create a new file called ifcfg-ens192:1 with the follwoing content:

    # cat /etc/sysconfig/network-scripts/ifcfg-ens192\:1
    DEVICE=ens192:1
    ONPARENT=on
    IPADDR=192.168.3.8
    PREFIX=24
    

    Afterwards I restart the network service via

    systemctl restart network
    to activate the new (virtual) interface. The new interface is active imediatly. How could I prevent this? The new IP should stay inactive until I enable it via
    ifup ens192\:1
    .

    Besides that, what do you suggest is the recommend way for RHEL 7 and RHEL 8 to bring up and down (virtual) interfaces? I would like to know how to control which IP is UP or DOWN and I'm not sure wether to choose

    ifup|ifdown
    ,
    ip
    or
    nmcli
    .

    When the additional/virtual interface is down, it is not shown in the output of

    ifconfig -a
    and
    ip a
    . How could I get a view of all virtual interfaces in status DOWN?

    I'm looking forward reading your suggestions.

    Best regards,

    Joerg

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat