local net="${ip_bits%/*}"
local netname="acnet_${net//./_}"
- local ip="${net%.*}.${IPNUM}"
- local mask="255.255.255.0"
+ local ip="${net%.*}.${IPNUM}/${ip_bits#*/}"
# This can be used to override the variables in the echo
# statement below. The hook can use any other variables
# available in this function.
run_hooks hack_network_map_hooks
- echo "${netname} ${dev} ${ip} ${mask} ${mac} ${opts}"
+ echo "${netname} ${dev} ${ip} ${mac} ${opts}"
count=$(($count + 1))
done >"$network_map"
}
# specified then use the IP address associated with it.
INSTALL_IP=""
INSTALL_GW=""
- local netname dev ip mask mac opts
- while read netname dev ip mask mac opts; do
+ local netname dev ip mac opts
+ while read netname dev ip mac opts; do
local o
for o in $opts ; do
case "$o" in
diskimage rm_rf "/etc/udev/rules.d/70-persistent-net.rules"
echo "Setting up network interfaces: "
- local netname dev ip mask mac opts
- while read netname dev ip mask mac opts; do
+ local netname dev ip mac opts
+ while read netname dev ip mac opts; do
echo " $dev"
- local o gw
+ local o gw addr mask
gw=""
for o in $opts ; do
case "$o" in
esac
done
+ addr=${ip%/*}
+ mask=$(ipv4_prefix_to_netmask ${ip#*/})
+
cat <<EOF | \
diskimage put - "/etc/sysconfig/network-scripts/ifcfg-${dev}"
DEVICE=$dev
ONBOOT=yes
TYPE=Ethernet
-IPADDR=$ip
+IPADDR=$addr
NETMASK=$mask
HWADDR=$mac
${gw:+GATEWAY=}${gw}