Compare commits

..

1 Commits

@ -29,19 +29,20 @@ List of tested platforms only:
| Platform | Versions |
|---------------------------------|------------------------------------------|
| AlmaLinux | 8, 9 |
| Alpine Linux | 3.15, 3.16, 3.17 |
| Alpine Linux | 3.13, 3.14, 3.15 |
| ALT Linux | 9, 10, Sisyphus |
| Amazon Linux | 2 |
| CentOS | 7, 8 Stream |
| Debian | 10, 11, 12 |
| Devuan | 3,4 |
| Fedora | 36, 37 |
| Devuan | 2 |
| Fedora | 34, 35 |
| FreeBSD | 12, 13 |
| MSVSphere | 8, 9 |
| openSUSE | 15 |
| Oracle Linux | 7, 8, 9 |
| Oracle Linux | 7, 8 |
| Red Hat Enterprise Linux | 7, 8, 9 |
| Rocky Linux | 8,9 |
| Ubuntu | 18.04, 20.04, 22.04 |
| Rocky Linux | 8 |
| Ubuntu | 16.04, 18.04, 20.04, 21.10, 22.04 |
| Ubuntu Minimal | 20.04, 22.04 |
(the packages might work on other versions or flavours, but those aren't tested)
@ -77,20 +78,20 @@ Following IPv6 configuration methods are supported via NIC attribute `IP6_METHOD
Selectable configuration types and IP configuration methods are **supported only on the following platforms**:
| Platform | Network Type (`NETCFG_TYPE`) |
|---------------------------------------------------------------|-------------------------------------------|
| Alpine Linux 3.15+ | `interfaces` |
| ALT Linux p10, Sisyphus | `networkd`, `nm` |
| Amazon Linux 2 | `scripts` |
| Debian 10+ | `interfaces`, `netplan`, `nm`, `networkd` |
| Devuan 3 | `interfaces` |
| Fedora 36+ | `scripts`, `nm`, `networkd` |
| FreeBSD 12+ | `bsd` |
| openSUSE 15 | `scripts` |
| RHEL-like 7 (CentOS, Oracle Linux) | `scripts` |
| RHEL-like 8 (CentOS, Oracle/Rocky/AlmaLinux) | `scripts`, `nm`, `networkd` |
| RHEL-like 9 (CentOS Stream 9, Oracle/Rocky/AlmaLinux) | `nm`, `networkd` |
| Ubuntu 18.04, 20.04, 22.04 | `interfaces`, `netplan`, `nm`, `networkd` |
| Platform | Network Type (`NETCFG_TYPE`) |
|-----------------------------------------------------------------|-------------------------------------------|
| Alpine Linux 3.14+ | `interfaces` |
| ALT Linux p10, Sisyphus | `networkd`, `nm` |
| Amazon Linux 2 | `scripts` |
| Debian 10+ | `interfaces`, `netplan`, `nm`, `networkd` |
| Devuan 2 | `interfaces` |
| Fedora 34+ | `scripts`, `nm`, `networkd` |
| FreeBSD 12+ | `bsd` |
| openSUSE 15 | `scripts` |
| RHEL-like 7 (CentOS, Oracle Linux) | `scripts` |
| RHEL-like 8 (CentOS, Oracle/Rocky/AlmaLinux/MSVSphere) | `scripts`, `nm`, `networkd` |
| RHEL-like 9 (CentOS Stream 9, Oracle/Rocky/AlmaLinux/MSVSphere) | `nm`, `networkd` |
| Ubuntu 18.04, 20.04, 21.10, 22.04 | `interfaces`, `netplan`, `nm`, `networkd` |
(other than listed platforms are not supported for using `NETCFG_TYPE` nor `METHOD`/`IP6_METHOD`!):

@ -41,7 +41,7 @@ fi
###
VERSION=${VERSION:-6.6.1}
VERSION=${VERSION:-6.6.0}
RELEASE=${RELEASE:-1}
MAINTAINER=${MAINTAINER:-OpenNebula Systems <contact@opennebula.io>}
LICENSE=${LICENSE:-Apache 2.0}

@ -39,7 +39,7 @@ if [ -z "${NETCFG_TYPE}" ] ; then
debian|devuan|ubuntu)
NETCFG_TYPE='interfaces netplan nm networkd'
;;
fedora|centos|rhel|almalinux|ol|rocky)
fedora|centos|rhel|almalinux|ol|rocky|msvsphere)
NETCFG_TYPE='scripts nm networkd'
;;
opensuse*|sles|sled)

@ -571,35 +571,3 @@ gen_resolvconf()
sed -i "/^NETCONFIG_DNS_STATIC_SEARCHLIST=/ s/=.*$/=\"${all_search_domains}\"/" /etc/sysconfig/network/config
fi
}
# Space separate source, destination and output interface of a route
get_route_info() {
route=$1
# Remove whitespaces beginning and end
route=$(echo "$route" | sed 's/^[[:space:]]*//')
route=$(echo "$route" | sed 's/[[:space:]]*$//')
# Parse traffic source, destination and outgoing interface
dst=$(echo "$route" | cut -d ' ' -f 1)
if [[ "$route" == *"via"* ]]; then
gw=${route##*" via "}
gw=${gw%" dev"*}
else
gw=''
fi
if [[ "$route" == *"dev"* ]]; then
iface=${route##*" dev "}
else
iface=''
fi
echo "$dst $gw $iface"
}
# 0 if https://en.wikipedia.org/wiki/Link-local_address
is_link_local() {
[[ $1 == "169.254."* ]]
}

@ -117,59 +117,8 @@ gen_iface_conf()
###
routes_conf_path="/etc/rc.conf.d/routing"
if [ -n "${gateway}" ]; then
echo "defaultrouter=\"${gateway}\"" >> $routes_conf_path
fi
# Add static routes
# static_routes="lan mumoffice foo"
# route_lan="-net 192.168.1.0/24 192.168.1.254"
# route_mumoffice="-net 10.0.0.0/8 10.30.110.5"
# route_foo="-host 169.254.1.1 -iface lo0"
route_names=""
if [ -n "${ROUTES}" ]; then
IFS=',' read -r -a routes <<< "$ROUTES"
routes_conf=()
for index in "${!routes[@]}"
do
route_name="lan${index}"
route_names="${route_names}${route_name} "
IFS=' ' read -r -a route_info <<< "$(get_route_info "${routes[index]}")"
dst=${route_info[0]}
gw=${route_info[1]}
iface=${route_info[2]}
route_conf="${route_name}=\"-net${dst} ${gw}\""
[ -n "${iface}" ] && route_conf=" ${route_conf} -iface ${dev}"
routes_conf+=(route_conf)
done
echo -e "static_routes=\"${route_names}\"\n" >> $routes_conf_path
for route_conf in "${routes_conf[@]}"
do
echo -e "$route_conf\n" >> $routes_conf_path
done
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
route_name="onegateproxy"
sed -i "s/${route_names}/${route_names} ${route_name}/g" "$routes_conf_path"
# ip route replace 169.254.16.9/32 via eth0
route_conf="route_${route_name}=\"-host ${ONEGATE_ENDPOINT} -iface ${dev}\""
echo -e "$route_conf\n" >> $routes_conf_path
echo "defaultrouter=\"${gateway}\"" >> /etc/rc.conf.d/routing
fi
}

@ -158,27 +158,6 @@ EOT
fi
fi
# Add static routes
if [ -n "${ROUTES}" ]; then
IFS=',' read -r -a routes <<< "$ROUTES"
for route in "${routes[@]}"
do
# Apply every route except the ones specified for other devices
if [[ "$route" == *"${dev}"* ]] || [[ "$dev" == "eth0" && "$route" != *"dev"* ]]; then
echo " up ip route add $route"
fi
done
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
# ip route replace 169.254.16.9/32 via eth0
echo " up ip route replace ${ONEGATE_ENDPOINT}/32 via ${dev}"
fi
if [ -n "$mtu" ]; then
echo " mtu ${mtu}"
fi

@ -135,8 +135,6 @@ gen_routes()
via: ${gateway}
EOT
# Force default Linux IPv4 metric (man 8 route) to override
# automatic metrics calculation done by NetworkManager and unify
# behavior among different renderers.
@ -147,40 +145,6 @@ EOT
fi
fi
# Add static routes
if [ -n "${ROUTES}" ]; then
IFS=',' read -r -a routes <<< "$ROUTES"
for route in "${routes[@]}"
do
# Apply every route except the ones specified for other devices
if [[ "$route" == *"${dev}"* ]] || [[ "$dev" == "eth0" && "$route" != *"dev"* ]]; then
IFS=' ' read -r -a route_info <<< "$(get_route_info "$route")"
dst=${route_info[0]}
gw=${route_info[1]}
cat <<EOT
- to: "${dst}"
via: "${gw}"
EOT
fi
done
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
# ip route replace 169.254.16.9/32 via eth0
echo " up ip route replace ${ONEGATE_ENDPOINT}/32 via ${dev}"
cat <<EOT
- to: "${ONEGATE_ENDPOINT}"
scope: link
EOT
fi
if [ -n "${ip6_gateway}" ] && { [ -z "${ip6_method}" ] || [ "${ip6_method}" = 'static' ]; }; then
cat <<EOT
- to: "::/0"

@ -120,42 +120,6 @@ EOT
fi
echo ""
# Add static routes
if [ -n "${ROUTES}" ]; then
cat <<EOT
[Route]
EOT
IFS=',' read -r -a routes <<< "$ROUTES"
for route in "${routes[@]}"
do
# Apply every route except the ones specified for other devices
if [[ "$route" == *"${dev}"* ]] || [[ "$dev" == "eth0" && "$route" != *"dev"* ]]; then
IFS=' ' read -r -a route_info <<< "$(get_route_info "$route")"
dst=${route_info[0]}
gw=${route_info[1]}
echo "Gateway=$gw"
echo "Destination=$dst"
fi
done
echo ""
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
cat <<EOT
[Route]
EOT
# ip route replace 169.254.16.9/32 via eth0
echo " up ip route replace ${ONEGATE_ENDPOINT}/32 via ${dev}"
echo "Destination=${ONEGATE_ENDPOINT}"
echo "Scope=link"
fi
}
gen_dhcp_conf()

@ -119,33 +119,6 @@ gen_iface_conf()
nmcli con mod "${dev}" ipv4.gateway ""
fi
# Add static routes
if [ -n "${ROUTES}" ]; then
IFS=',' read -r -a routes <<< "$ROUTES"
for route in "${routes[@]}"
do
IFS=' ' read -r -a route_info <<< "$(get_route_info "$route")"
dst=${route_info[0]}
gw=${route_info[1]}
# Apply every route except the ones specified for other devices
if [[ "$route" == *"${dev}"* ]] || [[ "$dev" == "eth0" && "$route" != *"dev"* ]]; then
nmcli con mod "$dev" ipv4.routes "$dst" "$gw"
fi
done
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
# ip route replace 169.254.16.9/32 via eth0
echo " up ip route replace ${ONEGATE_ENDPOINT}/32 via ${dev}"
nmcli con mod "$dev" ipv4.routes "$dst" type=local
fi
if [ -n "$metric" ]; then
nmcli con mod "${dev}" ipv4.route-metric "${metric}"
else

@ -124,31 +124,6 @@ EOT
fi
fi
# Add static routes
if [ -n "${ROUTES}" ]; then
IFS=',' read -r -a routes <<< "$ROUTES"
for route in "${routes[@]}"
do
# The route is targeted to the $dev iface
if [[ "$route" == *"${dev}"* ]]; then
echo "$route" >> "${config_path}/route-${dev}"
# The route with no target iface will be set to eth0
elif [[ "$dev" == "eth0" && "$route" != *"dev"* ]]; then
echo "$route" >> "${config_path}/route-eth0"
fi
done
fi
# Add ONEGATE Proxy static route
if is_link_local "${ONEGATE_ENDPOINT}"; then
# ip route replace 169.254.16.9/32 via eth0
route="${ONEGATE_ENDPOINT}/32 via ${dev}"
echo "$route" >> "${config_path}/route-${dev}"
fi
if [ -n "${mtu}" ]; then
echo "MTU=${mtu}"
fi

@ -513,7 +513,7 @@ syscheck()
debian|ubuntu|devuan)
return 0
;;
fedora|centos|rhel|almalinux|ol|rocky|amzn)
fedora|centos|rhel|almalinux|ol|rocky|amzn|msvsphere)
return 0
;;
opensuse*|sles|sled)
@ -553,7 +553,7 @@ enter_single_mode()
return 0
fi
;;
debian|ubuntu|devuan|fedora|centos|rhel|almalinux|ol|rocky|altlinux|opensuse*)
debian|ubuntu|devuan|fedora|centos|rhel|almalinux|ol|rocky|msvsphere|altlinux|opensuse*)
_runlevel=$(runlevel | cut -d" " -f2)
case "$_runlevel" in
1|S)
@ -589,7 +589,7 @@ enter_single_mode()
msg "Entering single user mode..."
rc single
;;
debian|ubuntu|devuan|fedora|centos|rhel|almalinux|ol|rocky|altlinux|opensuse*)
debian|ubuntu|devuan|fedora|centos|rhel|almalinux|ol|rocky|msvsphere|altlinux|opensuse*)
ask_to_enter_single_user_mode
msg "Entering single user mode..."
telinit 1

Loading…
Cancel
Save