Bug 1113983
Summary: | netcf should allow interfaces to be configured with both DHCPv4 and static IPv4 addresses at the same time | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Hu Jianwei <jiahu> |
Component: | netcf | Assignee: | Laine Stump <laine> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.1 | CC: | dyuan, honzhang, jsuchane, mzhan, rbalakri |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | netcf-0.2.8-1.el7 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-11-19 08:58:16 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Hu Jianwei
2014-06-27 11:54:57 UTC
For ipv4, the combination gets rejected by netcf, because it doesn't match the schema. For ipv6, it accepts both. I don't think libvirt should forbid this, moving to netcf. There is nothing in the design of DHCP to prevent having a DHCP-provided IP address on the same interface as one or more static IP addresses. However, a short experiment with IPv4 on a system running NetworkManager shows that this is silently not supported for IPv4. I don't currently have the proper setup to test it for IPv6 so I can't say for certain if IPv6 suffers the same problem - this is all a long winded way of saying that I don't think allowing this is a bug, but can't verify it with enough certainty to close the report right now. I think the commit log of the patch I've posted upstream explains the situation fairly well (this patch hasn't yet been pushed - it is pending review): Author: Laine Stump <laine> Date: Mon Mar 30 16:20:19 2015 -0400 Allow IPv4 static addresses simultaneous with DHCP Because initscripts network startup ends up ignoring static IPv4 addresses when dhcp is enabled (BOOTPROTO=dhcp in the ifcfg file) and because at least some of the frontends to Network Manager disable configuring a static address if dhcp is enabled (and likely due to other indications, but this all happened far in the past...) netcf has always made DHCP and static IP addresses for IPv4 mutually exclusive in the config - an interface either had one or it had the other. A recent BZ filed against libvirt: https://bugzilla.redhat.com/show_bug.cgi?id=1113983 suggested that we should also forbid simultaneous DHCP and static IPs for IPv6, but investigation shows the following: 1) there is nothing inherent in the DHCP protocol that precludes having both a single DHCP address and one or more static IP addresses from each protocol (as well as an IPv6 address learned via IPv6 autoconf). Even the lead NetworkManager developer says this in an email response to a question posed on the dnsmasq mailing list: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2015q1/009346.html 2) Different networking backends currently properly support different combinations of these address types for the two platforms (for example, NetworkManager 0.9.10.2 on Fedora 21 will properly acquire a DHCPv4 address to live alongside multiple static IPv4 addresses while initscripts 9.56.7 will discard the static IPs, and initscripts will support multiple static IPv6 addresses together with an autoconf address, while NetworkManager apparently won't (although this could be a configuration error on my part). In the end, any time that all three address types for IPv6 (autoconf, dhcp, static) or two address types for IPv4 (dhcp, static) cannot work simultaneously on the same interface, that is a bug in the networking backend (e.g. initscripts, NetworkManager), *not* a reason to disallow such configurations via netcf. For that reason, this patch opens up the RNG for the IPv4 protocol, allowing <dhcp/> to be specified simultaneously with any number of static <ip> elements for IPv4, just as we already did for IPv6. Any future failures of such configurations to work properly should result in bugs filed against the network backend in use at the time (or possibly the dhcp server, or some other piece of infrastructure). Pushed upstream: commit 0013d5a2ccf61e58b021feead6ed66813ee50f65 Author: Laine Stump <laine> Date: Mon Mar 30 16:20:19 2015 -0400 Allow IPv4 static addresses simultaneous with DHCP Reproduce it with old version: [root@localhost ~]# rpm -q libvirt netcf libvirt-1.2.15-2.el7.x86_64 netcf-0.2.6-3.el7.x86_64 [root@localhost ~]# cat eth1.xml <interface type='ethernet' name='eth1'> <start mode='none'/> <mac address='00:1B:21:27:4E:CE'/> <mtu size='1500'/> <protocol family='ipv4'> <dhcp/> <ip address='192.168.1.111' prefix='24'/> </protocol> <protocol family='ipv6'> <dhcp/> <ip address='2001:db8:ca2:2::1' prefix='64'/> </protocol> </interface> [root@localhost ~]# virsh iface-define eth1.xml error: Failed to define interface from eth1.xml error: XML error: could not get interface XML description: XML invalid - Extra element protocol in interleave [root@localhost ~]# ncftool define eth1.xml error: XML invalid error: Extra element protocol in interleave 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 ~]# [root@localhost ~]# [root@localhost ~]# cat eth1.xml <interface type='ethernet' name='eth1'> <start mode='none'/> <mac address='00:1B:21:27:4E:CE'/> <mtu size='1500'/> <protocol family='ipv4'> <dhcp/> <ip address='192.168.1.111' prefix='24'/> </protocol> <protocol family='ipv6'> <dhcp/> <ip address='2001:db8:ca2:2::1' prefix='64'/> </protocol> </interface> [root@localhost ~]# virsh iface-define eth1.xml Interface eth1 defined from eth1.xml [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE="eth1" HWADDR="00:1B:21:27:4E:CE" ONBOOT="no" MTU="1500" BOOTPROTO="dhcp" IPADDR="192.168.1.111" NETMASK="255.255.255.0" IPV6INIT="yes" IPV6_AUTOCONF="no" DHCPV6C="yes" IPV6ADDR="2001:db8:ca2:2::1/64" [root@localhost ~]# [root@localhost ~]# virsh iface-undefine eth1 Interface eth1 undefined [root@localhost ~]# ncftool define eth1.xml Defined interface eth1 [root@localhost ~]# [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE="eth1" HWADDR="00:1B:21:27:4E:CE" ONBOOT="no" MTU="1500" BOOTPROTO="dhcp" IPADDR="192.168.1.111" NETMASK="255.255.255.0" IPV6INIT="yes" IPV6_AUTOCONF="no" DHCPV6C="yes" IPV6ADDR="2001:db8:ca2:2::1/64" netcf can configure with both DHCPv4 and static IPv4 addresses. 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 |