Red Hat Bugzilla – Bug 1159000
netcf ignores any IPv4 address past the first one
Last modified: 2015-11-19 03:58:21 EST
+++ This bug was initially created as a clone of Bug #1147650 +++ Step 2 of the "reproduction" description from Hu Jianwei in Bug 1147650 attempts to add a 2nd IPv4 address to an interface, which is also a bug, but out of the scope of that bug report. This BZ is filed to track support for multiple IPv4 addresses on an interface. Here is the reproduction case: [root@localhost ~]# rpm -q libvirt netcf-libs libvirt-1.2.8-5.el7.x86_64 netcf-libs-0.2.6-1.el7.x86_64 [...] 2. Add a new IP using nmtui [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp16s0f1 DEVICE=enp16s0f1 ONBOOT=no IPV6INIT=yes IPV6_AUTOCONF=yes TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME="System enp16s0f1" UUID=c5a180f8-a44b-bfc8-6f45-0f171f275fac IPADDR=192.168.1.22 PREFIX=24 GATEWAY=192.168.1.1 IPADDR1=192.168.1.88 <====here PREFIX1=24 <====here IPV6_PEERDNS=yes IPV6_PEERROUTES=yes [root@localhost ~]# virsh iface-dumpxml enp16s0f1 <interface type='ethernet' name='enp16s0f1'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> <ip address='192.168.1.88' prefix='24'/> </protocol> <link speed='10' state='up'/> <mac address='00:1b:21:55:b3:bd'/> </interface> [root@localhost ~]# ip ad show enp16s0f1 7: enp16s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:1b:21:55:b3:bd brd ff:ff:ff:ff:ff:ff inet 192.168.1.22/24 brd 192.168.1.255 scope global enp16s0f1 valid_lft forever preferred_lft forever inet 192.168.1.88/24 brd 192.168.1.255 scope global secondary enp16s0f1 valid_lft forever preferred_lft forever [root@localhost ~]# virsh iface-bridge enp16s0f1 br66 --no-stp Created bridge br66 with attached device enp16s0f1 Bridge interface br66 started [root@localhost ~]# virsh iface-dumpxml br66 <interface type='bridge' name='br66'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> </protocol> <protocol family='ipv6'> <ip address='fe80::21b:21ff:fe55:b3bd' prefix='64'/> </protocol> <bridge> <interface type='ethernet' name='enp16s0f1'> <link speed='10' state='up'/> <mac address='00:1b:21:55:b3:bd'/> </interface> </bridge> </interface> [root@localhost ~]# virsh iface-list --all Name State MAC Address --------------------------------------------------- br66 active 00:1b:21:55:b3:bd .. [root@localhost ~]# ip ad show br66 27: br66: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 00:1b:21:55:b3:bd brd ff:ff:ff:ff:ff:ff inet 192.168.1.22/24 brd 192.168.1.255 scope global br66 valid_lft forever preferred_lft forever inet6 fe80::21b:21ff:fe55:b3bd/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# virsh iface-unbridge br66 Device enp16s0f1 un-attached from bridge br66 Interface enp16s0f1 started [root@localhost ~]# virsh iface-dumpxml enp16s0f1 <interface type='ethernet' name='enp16s0f1'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> </protocol> <link speed='10' state='up'/> <mac address='00:1b:21:55:b3:bd'/> </interface> [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp16s0f1 DEVICE=enp16s0f1 ONBOOT=no BOOTPROTO=none IPADDR=192.168.1.22 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 IPV6INIT=yes IPV6_AUTOCONF=yes DHCPV6C=no <=== the second IP is disappeared.
The grammars for the <interface> xml in netcf and libvirt already support multiple <ip> elements, so all that is needed for this is to make redhat-(get|put).xsl recognize and emit IPADDRn/PREFIXn/NETMASKn/GATEWAYn. This cries out for someone with a better understanding of xslt than me.
Fix pushed upstream: commit 4b4193c6d0bdbf96f63473a90d65bb4480c14aef Author: Laine Stump <laine@laine.org> Date: Mon Mar 16 10:50:33 2015 -0400 support multiple IPv4 addresses in redhat driver
Verified as below: [root@localhost ~]# rpm -q libvirt netcf libvirt-1.2.15-2.el7.x86_64 netcf-0.2.8-1.el7.x86_64 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0 DEVICE="enp2s0" ONBOOT="no" BOOTPROTO="none" IPADDR="192.168.1.22" NETMASK="255.255.255.0" IPADDR1="192.168.1.88" NETMASK1="255.255.255.0" GATEWAY="192.168.1.1" IPV6INIT="yes" IPV6_AUTOCONF="yes" DHCPV6C="no" [root@localhost ~]# virsh iface-dumpxml enp2s0 <interface type='ethernet' name='enp2s0'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> <ip address='192.168.1.88' prefix='24'/> </protocol> <link speed='100' state='up'/> <mac address='00:1b:21:27:4e:ce'/> </interface> [root@localhost ~]# ip ad show enp2s0 3: enp2s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000 link/ether 00:1b:21:27:4e:ce brd ff:ff:ff:ff:ff:ff inet 192.168.1.22/24 brd 192.168.1.255 scope global enp2s0 valid_lft forever preferred_lft forever inet 192.168.1.88/24 brd 192.168.1.255 scope global secondary enp2s0 valid_lft forever preferred_lft forever [root@localhost ~]# virsh iface-bridge enp2s0 br66 --no-stp Created bridge br66 with attached device enp2s0 Bridge interface br66 started [root@localhost ~]# virsh iface-dumpxml br66 <interface type='bridge' name='br66'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> <ip address='192.168.1.88' prefix='24'/> </protocol> <protocol family='ipv6'> <ip address='fe80::7c2b:bff:fef0:fe1f' prefix='64'/> </protocol> <bridge> </bridge> </interface> [root@localhost ~]# virsh iface-list --all Name State MAC Address --------------------------------------------------- br66 active 7e:2b:0b:f0:fe:1f eno1 active 24:be:05:18:81:ce [root@localhost ~]# ip ad show br66 148: br66: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 7e:2b:0b:f0:fe:1f brd ff:ff:ff:ff:ff:ff inet 192.168.1.22/24 brd 192.168.1.255 scope global br66 valid_lft forever preferred_lft forever inet 192.168.1.88/24 brd 192.168.1.255 scope global secondary br66 valid_lft forever preferred_lft forever inet6 fe80::7c2b:bff:fef0:fe1f/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# virsh iface-unbridge br66 Device enp2s0 un-attached from bridge br66 Interface enp2s0 started [root@localhost libvirt-1.2.15]# virsh iface-list --all Name State MAC Address --------------------------------------------------- eno1 active 24:be:05:18:81:ce enp2s0 active 00:1b:21:27:4e:ce [root@localhost ~]# virsh iface-dumpxml enp2s0 <interface type='ethernet' name='enp2s0'> <protocol family='ipv4'> <ip address='192.168.1.22' prefix='24'/> <ip address='192.168.1.88' prefix='24'/> </protocol> <link speed='100' state='up'/> <mac address='00:1b:21:27:4e:ce'/> </interface> [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0 DEVICE="enp2s0" ONBOOT="no" BOOTPROTO="none" IPADDR="192.168.1.22" NETMASK="255.255.255.0" IPADDR1="192.168.1.88" NETMASK1="255.255.255.0" GATEWAY="192.168.1.1" IPV6INIT="yes" IPV6_AUTOCONF="yes" DHCPV6C="no"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-2248.html