[CentOS] more than one IP address on network device?

Gordon Messmer gordon.messmer at gmail.com
Tue Sep 6 23:46:22 UTC 2016

On 09/03/2016 10:34 AM, Walter H. wrote:
> /etc/sysconfig/network-scripts/ifcfg-eth0:1
> # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper), Alias 1
> TYPE=Ethernet
> DEVICE=eth0:1
> DNS1=
> DNS2=

In alias files:
  * BOOTPROTO isn't used, since you can't run dhclient on an alias interface
  * GATEWAY is disregarded if it is already set
  * DNS* aren't used at all

...and in no case do you really need to specify all of BROADCAST, 
NETWORK, and NETMASK.  The latter, alone, is sufficient.

See /usr/share/doc/initscripts*/sysconfig.txt and 
/etc/sysconfig/network-scripts/ifup-aliases for more information.

Since not all of them were mentioned in this thread, there are at least 
three ways to specify additional IPv4 addresses.  First, use IPADDRn and 
either PREFIXn or NETMASKn in ifcfg-dev (documented in sysconfig.txt).  
Second, use alias files such as ifcfg-dev:alias (documented in 
sysconfig.txt).  Third, use range files such as ifcfg-dev-range0 to 
specify all of the addresses from a START to an END address (documented 
in ifup-aliases).

> why can't I add this to the virtual device eth0:1,
> if I needed both an additional IPv4 and an additional IPv6 address?
> IPV6INIT=yes
> IPV6ADDR=ipv6addr
> IPV6_DEFAULTGW=ipv6addr-gateway

Mostly because device aliases are obsolete:

More information about the CentOS mailing list