Bug 1464999 - After setting ipv6 to dhcp its not possible to set it back to static
After setting ipv6 to dhcp its not possible to set it back to static
Status: POST
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance (Show other bugs)
5.8.0
Unspecified Unspecified
medium Severity high
: GA
: 5.9.0
Assigned To: Bo Yao
luke couzens
black:ipv6
: TestOnly, ZStream
Depends On:
Blocks: 1472842
  Show dependency treegraph
 
Reported: 2017-06-26 07:48 EDT by luke couzens
Modified: 2017-07-21 09:49 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1472842 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core


Attachments (Terms of Use)

  None (edit)
Description luke couzens 2017-06-26 07:48:13 EDT
Description of problem:After setting ipv6 to dhcp its not possible to set it back to static


Version-Release number of selected component (if applicable):5.8.1.0


How reproducible:100%


Steps to Reproduce:
1.Provision appliance
2.ssh to appliance
3.Launch appliance_console
4.set ipv6 to dhcp
5.Try setting it back to static

Actual results:
Network interface failed to start using the values supplied

Expected results:static ipv6 set correctly


Additional info:
After this failure both ipv6 and ipv4 have been lost from configuration
Comment 3 Nick Carboni 2017-07-17 17:39:48 EDT
I'm not sure we have a solution for this yet, but we have made some progress.

TLDR; There are two work-arounds for this, either:
`rm /var/run/dhclient6-eth0.pid` (assuming a process with pid in the file doesn't exist)
or:
Just do the config through the console again

More detail to follow:

After making changes to a network interface config file we run `ifdown eth0` then `ifup eth0` to make the changes take effect.

For some reason when we set ipv6 config to dhcp, dhclient fails to start properly, leaving a pid file (/var/run/dhclient6-eth0.pid). This, in my opinion, is a bug in dhclient. In my testing I typically will get an address, but dhclient will not be running for IPv6 (the command line should have the -6 option).

When we then try to set the config to static, we attempt to `ifdown eth0` which tries to stop the instance of dhclient that should be running based on the presence if the pid file. This causes the ifdown command to return an error status and we fail.

Because the error is being caused by a file rather than a misconfiguration you can simply remove the pid file and then set the static address using the console. Alternatively, after hitting the issue once, you should be able to run through the configuration again because ifdown removes the pid file (even though it fails).

Luke,

Can you test out these workarounds?
Comment 4 CFME Bot 2017-07-18 16:15:21 EDT
New commit detected on ManageIQ/linux_admin/master:
https://github.com/ManageIQ/linux_admin/commit/568f56a5fa66fb87bb62aff7458089d30bc15420

commit 568f56a5fa66fb87bb62aff7458089d30bc15420
Author:     Bo Yao <boyao@redhat.com>
AuthorDate: Fri Jul 14 11:47:32 2017 -0400
Commit:     Bo Yao <boyao@redhat.com>
CommitDate: Tue Jul 18 16:06:51 2017 -0400

    Fix configure network fails after a success DHCP configuration
    https://bugzilla.redhat.com/show_bug.cgi?id=1464999

 lib/linux_admin/network_interface/network_interface_rh.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 5 Satoe Imaishi 2017-07-19 09:54:55 EDT
PR to bump linux_admin version: https://github.com/ManageIQ/manageiq-gems-pending/pull/243
Comment 7 luke couzens 2017-07-20 05:11:35 EDT
Both workarounds do seem to work for setting ipv6, but its still required to run this from a provider console and not through ssh to the appliance as ipv4 still gets dropped.
Comment 8 Bo Yao 2017-07-21 09:49:41 EDT
(In reply to luke couzens from comment #7)
> Both workarounds do seem to work for setting ipv6, but its still required to
> run this from a provider console and not through ssh to the appliance as
> ipv4 still gets dropped.

Currently what we did in setting the network is shutting down network interface and change in network configuration file then start network interface. I did some search found both ipv4 and ipv6 change to an interface (eth0) need restart network service. 
https://askubuntu.com/questions/76742/restarting-the-ipv6-network-stack-without-restarting-the-ipv4-network-stack
This is not very authoritative, but no more I can found for adding ipv6 address without restarting network interface in Red Hat, Debian, Ubuntu and Archlinux official docs, so we can generally think it's not possible.

Reference:
https://access.redhat.com/solutions/347693
https://wiki.debian.org/DebianIPv6
https://wiki.ubuntu.com/IPv6
https://wiki.archlinux.org/index.php/IPv6

But there are simple ways to do this in ssh client side to avoid drop ssh connection:
1) using screen or tmux with ssh to suspend the ssh client;
2) using mosh: https://github.com/mobile-shell/mosh
It's a enhanced ssh run "server" on both client and server side. When server ip address change/temporarily restart, it can keep connection alive.

Note You need to log in before you can comment on or make changes to this bug.