f94508d537
When the rdisc6 utility is available probe for router advertisement. configure eni and rhel-netscripts interfaces to do IPv6 address configuration according to the flags in the RA recived from the router. The systemd service file timeout is DIB_DHCP_TIMEOUT * 2, so that DHCPv4 can timout, and dhcpv6 run before the service times out. Retries are commented in dhclient.conf, without it we end up trying DIB_DHCP_TIMEOUT * 60 before the client move on to IPv6. WHEN: Stateful address conf. : No Stateful other conf. : No THEN: Do not run dhclient at all, autoconfiguration via SLAAC only. WHEN: Stateful address conf. : No Stateful other conf. : Yes THEN: Run "dhclient -6 -S", The ``-S`` option makes the dhcp client not request an address, only other options such as DNS servers and NTP servers from DHCPv6 server. WHEN: Stateful address conf. : Yes Stateful other conf. : Yes THEN: The dhcp client should request an address _and_ other options such as DNS servers and NTP servers from DHCPv6 server. NOTE: No IPv6 support added for suse-netscripts Closes-Bug: 1754219 Change-Id: Icdc79875c33f894ab7eaec8afdfb33a731efff99
50 lines
2.4 KiB
Bash
Executable file
50 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
SCRIPTDIR=$(dirname $0)
|
|
|
|
# this script is not needed on Gentoo.
|
|
if [ "$DISTRO_NAME" != "gentoo" ]; then
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh
|
|
sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh
|
|
fi
|
|
|
|
if [ -f /etc/dhcp/dhclient.conf ] ; then
|
|
# Set the dhclient timeout configurations to match DIB_DHCP_TIMEOUT,
|
|
if grep -o "^timeout " /etc/dhcp/dhclient.conf ; then
|
|
sed -i -e "s/^timeout .*/# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30};/" /etc/dhcp/dhclient.conf
|
|
else
|
|
echo -e "# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30};" >> /etc/dhcp/dhclient.conf
|
|
fi
|
|
if grep -o "^retry " /etc/dhcp/dhclient.conf ; then
|
|
sed -i -e '/^retry/s/^/# \"retry\" Value commented by dhcp-all-interfaces\n# /g' /etc/dhcp/dhclient.conf
|
|
fi
|
|
fi
|
|
|
|
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
|
if [ -e "/etc/redhat-release" ] ; then
|
|
# the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6)
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces
|
|
chkconfig dhcp-all-interfaces on
|
|
else
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf
|
|
fi
|
|
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
|
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service
|
|
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules
|
|
sed -i "s/TimeoutStartSec=DIB_DHCP_TIMEOUT/TimeoutStartSec=$(( ${DIB_DHCP_TIMEOUT:-30} * 2 ))s/" /usr/lib/systemd/system/dhcp-interface@.service
|
|
elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces
|
|
update-rc.d dhcp-all-interfaces defaults
|
|
elif [ "$DISTRO_NAME" == "gentoo" ]; then
|
|
# let ipv6 use normal slaac
|
|
sed -i 's/slaac/#slaac/g' /etc/dhcpcd.conf
|
|
# don't let dhcpcd set domain name or hostname
|
|
sed -i 's/domain_name\,\ domain_search\,\ host_name/domain_search/g' /etc/dhcpcd.conf
|
|
rc-update add dhcpcd default
|
|
fi
|