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



On Wed, 2015-09-30 at 15:28 -0400, Derek Atkins wrote:
Dan,

On Wed, September 30, 2015 12:44 pm, Dan Williams wrote:
On Wed, 2015-09-30 at 12:25 -0400, Derek Atkins wrote:
Dan,

Dan Williams <dcbw redhat com> writes:

I.e., just to make sure I understand correctly, in order to get what I
want I should just create /etc/sysconfig/network-scripts/ifcfg-eth0:0
and let NM manage my alias that way?  Do I need to do anything special
to get NM to notice it, or it will do so automagically on the next
restart/reboot?

There are some alias examples here, FWIW:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/settings/plugins/ifcfg-rh/tests/network-scripts

And all that's really required is "nmcli con reload", you shouldn't ever
need to restart NetworkManager to get config changes taken into account.

I added this config file but it's not bringing up eth0:0.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
IPADDR=192.168.x.y   (yes, x.y are numbers)
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=no
#

What am I missing?  Do I need the base ifcfg-eth0 file, too?  (That file
was not created by anaconda).  Or do I need some additional fields because
there is no ifcfg-eth0?  Or do I need to tell NM to bring it up?

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.

Dan



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