1
0
mirror of synced 2026-01-23 10:38:15 +00:00
xen-tools.xen-tools/etc/hook.d/40-setup-networking
steve b23eed9aee 2006-05-23 15:51:15 by steve
YaY: Working network for static IP centos4 .. and more?
2006-05-23 15:51:15 +00:00

84 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#
# This script sets up the /etc/network/interface file for the new
# image.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
if [[ "${rpmstrap}" ]]; then
if [[ -e ${prefix}/etc/rc.d/rc.local ]]; then
echo "ifconfig eth0 ${ip} up" >> ${prefix}/etc/rc.d/rc.local
echo "route add default gw ${gateway}" >> ${prefix}/etc/rc.d/rc.local
exit
else
echo "TODO : Sort out networking for non-Debian distribution ${dist}."
exit;
fi
fi
#
# OK now we're in Debian-only land.
#
if [[ -z "${dhcp}" ]]; then
#
# 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 ${ip}
gateway ${gateway}
netmask ${netmask}
# 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
else
#
# 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
fi