Re: How to configure a DHCP + (2nd) Static address (eg on eth0+eth0:0)?



Hi Dan,

On Thu, October 1, 2015 12:49 pm, Dan Williams wrote:

Yes, you need a matching ifcfg file for the base interface.  So you need
both ifcfg-eth0 and ifcfg-eth0:0.  See the examples, eg ifcfg-aliasem0
and ifcfg-aliasem0:1.

The alias file should only have DEVICE and IPADDR fields; and DEVICE
must match that of the parent ifcfg file.  They are intimately tied
together in the old initscripts, and the ifcfg-rh plugin remains
compatible with those.

When NetworkManager sees the base file, it will also look for alias
files, and will add the IP address from the alias file to the main
connection's IP address list along with the label.  So even with two
ifcfg files, you will only have one connection and you should see *both*
IP addresses in that one connection.  When the connection is activated,
NM sends the label to the kernel, so /sbin/ip will show both addresses
on one interface, but /sbin/ifconfig will show two interfaces each with
one address, per its ignorance of the real situation.

Apparently this still isn't working.  I did the following:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
UUID=3a02edd8-e82d-4dca-a336-933e9177f4cd
DEVICE=eth0
ONBOOT=yes
HWADDR=00:1f:7b:b2:14:42
IPV6_FAILURE_FATAL=no
NAME=eth0
# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
IPADDR=192.168.x.y

and after an nmcli con reload it still doesn't provide the alias address. 
Nor after a reboot.

I'm sur I'm still missing *something* but I'm at a loss now.

Dan

-derek

-- 
       Derek Atkins                 617-623-3745
       derek ihtfp com             www.ihtfp.com
       Computer and Internet Security Consultant



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]