/usr/share/xen-tools/common/40-setup-networking-deb is in xen-tools 4.4-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | #!/bin/sh
#
# This script sets up the /etc/network/interface file for the new
# image.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
#
# Source our common functions
#
if [ -e /usr/share/xen-tools/common.sh ]; then
. /usr/share/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
#
# Make sure we have an /etc/network directory.
#
mkdir -p ${prefix}/etc/network
#
# A function to setup DHCP for our new image.
#
setupDynamicNetworking ()
{
#
# The host is using DHCP.
#
cat <<E_O_DHCP > ${prefix}/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# post-up ethtool -K eth0 tx off
#
# The commented out line above will disable TCP checksumming which
# might resolve problems for some users. It is disabled by default
#
E_O_DHCP
}
#
# A function to setup static IP addresses for our new image.
#
setupStaticNetworking ()
{
#
# if $p2p is set then add a "pointopoint" setting.
#
point='';
if [ -n "${p2p}" ]; then
point=" pointopoint ${p2p}"
else
point=''
fi
#
# broadcast address?
#
bcast='';
if [ -n "${broadcast}" ]; then
bcast=" broadcast ${broadcast}"
fi
#
# gateway address?
#
gateway='';
if [ -n "${gateway}" ]; then
gateway=" gateway ${gateway}"
fi
#
# We have a static IP address
#
cat <<E_O_STATIC >${prefix}/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address ${ip1}
${gateway}
netmask ${netmask}
${bcast}
${point}
# post-up ethtool -K eth0 tx off
#
# The commented out line above will disable TCP checksumming which
# might resolve problems for some users. It is disabled by default
#
E_O_STATIC
interface=1
count=2
while [ "${count}" -le "${ip_count}" ]; do
value=\$ip${count}
value=`eval echo $value`
logMessage Adding etho:${interface}
cat <<E_O_STATIC >>${prefix}/etc/network/interfaces
auto eth0:${interface}
iface eth0:${interface} inet static
address ${value}
netmask ${netmask}
# post-up ethtool -K eth0 tx off
E_O_STATIC
count=`expr $count + 1`
interface=`expr $interface + 1`
done
#
# Hooks are run chrooted, hence the resolv.conf is moved
# temporarily to /etc/resolv.conf.old. Use that file, it
# will be restored after hooks are run.
#
if [ '' != "$nameserver" ]; then
rm -f ${prefix}/etc/resolv.conf.old
for ns in $nameserver; do
echo "nameserver $ns" >>${prefix}/etc/resolv.conf.old
done
else
cp /etc/resolv.conf ${prefix}/etc/resolv.conf.old
fi
}
#
# Call the relevant function
#
if [ -z "${dhcp}" ]; then
logMessage "Setting up static networking"
setupStaticNetworking
else
logMessage "Setting up DHCP networking"
setupDynamicNetworking
fi
#
# Log our finish
#
logMessage Script $0 finished
|