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

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

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
> ONPARENT=yes
> BOOTPROTO=none
> BROADCAST=192.168.0.255
> IPADDR=192.168.0.17
> NETMASK=255.255.255.0
> NETWORK=192.168.0.0
> GATEWAY=192.168.0.1
> DNS1=192.168.0.1
> DNS2=192.168.0.100

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_AUTOCONF=no
> IPV6_DEFAULTGW=ipv6addr-gateway
> IPV6_DEFAULTDEV=eth0:1

Mostly because device aliases are obsolete:
https://www.kernel.org/doc/Documentation/networking/alias.txt