Commit f52ed723 authored by Russ Fish's avatar Russ Fish

Add devcon to up/down NIC's. Refine network and power settings.

parent 230c9aa9
......@@ -65,6 +65,8 @@ bin-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/usrtogrp.exe $(BINDIR)/usrtogrp.exe
# Setx is run under CMD early in the user login to make HOME for Emacs.
$(INSTALL) -m 755 $(SRCDIR)/setx.exe $(SYSTEM32)/setx.exe
# Devcon is used by rc.cygwin and rc.ifc to disable/enable NIC's.
$(INSTALL) -m 755 $(SRCDIR)/setx.exe $(BINDIR)/devcon.exe
# These are used by tmcd/findif.
$(INSTALL) -m 755 $(SYSTEM32)/getmac.exe $(BINDIR)/getmac.exe
$(INSTALL) -m 755 $(WBEM)/framedyn.dll $(BINDIR)/framedyn.dll
......
Binary software for Windows is on /share/windows .
================================================================
Available for installation, but not installed by default:
--------------------------------
Microsoft .NET Framework Version 1.1 Redistributable Package
The .NET Framework version 1.1 redistributable package includes everything you
need to run applications developed using the .NET Framework.
Web: http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en
Installer: dotnetfx.exe
--------------------------------
Ethereal/WinPcap - Network Monitor
Installers: ethereal-setup-0.10.6.exe, WinPcap_3_0.exe
--------------------------------
Mule-UCS - Unicode support for Emacs
Directory: Mule-UCS-0.84
--------------------------------
AboutTime - Network Time Protocol client
This was used in Emulab at first, until I figured how to get the
MS w32time client configured properly.
Installer: abouttime_msie.exe
Config file: AboutTime.ini
================================================================
Installed by default on Windows to make it more useful:
--------------------------------
WinZip 9.0
Web: www.winzip.com
Installer: winzip90.exe
--------------------------------
NTEmacs 21.3
Web: www.gnu.org/software/emacs/windows/ntemacs.html
Tarball: emacs-21.3-fullbin-i386.tar.gz
================================================================
Installed by default as part of the Emulab management for Windows:
--------------------------------
Cygwin = GNU + Cygnus + Windows
Web: www.cygwin.com
Installer: cygwin-setup.exe
--------------------------------
Include files for MySQL and Boost
Tarballs: {mysql,boost}-include.tgz
--------------------------------
Elvin - Event system.
Elvin server for Windows: elvin4-windows.tar.gz
Config file: elvind.conf.windows
--------------------------------
WSName.exe - Workstation Name Changer
Version 2.73
Date 14 November 2004
Author David Clarke
Function To change the workstations name (both NetBIOS and Host)
Operating Systems Windows 9x, NT4, 2000, XP, 2003
Distribution Status Freeware, subject to disclaimer
If you use it, I'd appreciate an email letting me know how you
use it and where, just for my interest
On the Web http://mystuff.clarke.co.nz (lots more details there.)
Contact Details email details can be found of the site above
--------------------------------
addusers.exe - Scripting for user account creation
Part of the Resource Kit for Windows 2000.
See "AddUsers Automates Creation of a Large Number of Users",
http://support.microsoft.com/default.aspx?scid=kb;en-us;199878
--------------------------------
usrtogrp.exe - Scripting for group membership.
Part of the Resource Kit for Windows 2000.
See "USRTOGRP.EXE useful for adding users to local or global groups"
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsNT/AdminTips/Utilities/USRTOGRP.EXEusefulforaddinguserstolocalorglobalgroups.html
--------------------------------
setx.exe - Set environment variables in the Windows Desktop environment.
Part of the Resource Kit for Windows 2000.
Executable: setx.exe
Web: www.microsoft.com/windows2000/techinfo/reskit/tools/existing/setx-o.asp
Installer: setx_setup.exe
EULA: setx_license.txt
Doc: setx_d.htm
--------------------------------
devcon.exe - Device controller. Scriptable command-line substitute for the
Network Connections and Device Manager GUIs.
Executable: devcon.exe
Self-extracting zip file: devcon-pkg.exe
Downloaded from the Microsoft Knowledge base:
FILE: DevCon Command Line Utility Alternative to Device Manager
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272
MSDN documentation:
Driver Development Tools: Windows DDK: DevCon
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ddtools/hh/ddtools/DevCon_744d640a-c44e-4cb9-a68f-60ce341d1c74.xml.asp
Device Installation: Windows DDK: Device Identification Strings
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/install/hh/install/idstrings_a974863f-a410-4259-8474-b57a3e20d326.xml.asp
================================================================
Windows drivers for the Emulab machines:
--------------------------------
Intel PRO NIC drivers
Installed on the pc600 and pc850.
Installer: pro2kxp.exe
--------------------------------
Intel PRO/1000 gigabit ether drivers, installed on the pc3000's.
LSI Logic Ultra320 SCSI 2000 drivers, installed on the pc3000's.
================================================================
......@@ -79,10 +79,11 @@ $HOSTSFILE = "$NTE/hosts";
#
# These are not exported
#
my $ADDUSERS = "$BINDIR/addusers.exe";
my $ADDUSERS = "$BINDIR/addusers.exe";
my $DEVCON = "$BINDIR/devcon.exe";
my $IFCONFIGBIN = "$NETSH interface ip set address";
my $IFCONFIG = "$IFCONFIGBIN name=\"%s\" source=static addr=%s mask=%s";
my $IFC_1000MBS = "1000baseTx";
my $IFCONFIG = "$IFCONFIGBIN name=\"%s\" source=static addr=%s mask=%s";
my $IFC_1000MBS = "1000baseTx";
my $IFC_100MBS = "100baseTx";
my $IFC_10MBS = "10baseT";
my $IFC_FDUPLEX = "FD";
......@@ -96,6 +97,7 @@ my $SHELLS = "/etc/shells";
my $DEFSHELL = "/bin/tcsh";
my $winusersfile = "$BOOTDIR/winusers";
my $usershellsfile = "$BOOTDIR/usershells";
my $XIMAP = "$BOOTDIR/xif_map";
#
# system() with error checking.
......@@ -237,18 +239,38 @@ sub os_accounts_sync()
# Generate and return an ifconfig line that is approriate for putting
# into a shell script (invoked at bootup).
#
my %dev_map = ();
sub os_ifconfig_line($$$$$$$;$$)
{
my ($iface, $inet, $mask, $speed, $duplex, $aliases,
$iface_type, $settings, $rtabid) = @_;
my ($uplines, $downlines);
if (! $dev_map) {
# Map from non-control interface names, e.g. "Local Area Connection #4"
# to the Device Instance ID's used as devcon arguments, e.g.
# "@PCI\VEN_8086&DEV_1010&SUBSYS_10128086&REV_01\5&2FA58B96&0&210030".
if (! open(DEVMAP, $XIMAP)) {
warning("Cannot open $XIMAP $!\n");
{
else {
while (my $dev_line = <DEVMAP>) {
chomp($dev_line);
my ($dev_name, $dev_inst) = split(":", $dev_line, 2);
$dev_map{$dev_name} = $dev_inst;
}
close(DEVMAP);
}
}
print "dev_map '$dev_map'\n";
if ($inet ne "") {
$uplines .= sprintf($IFCONFIG, $iface, $inet, $mask);
$uplines .= sprintf("\n echo \"Enabling %s on %s\"", $iface, $inet);
$uplines .= sprintf("\n $DEVCON enable '%s'" , $dev_map{$iface});
# No $downlines... Can't disable an interface???
# The command "netsh interface set interface name=... DISABLED"
# is specified as only for non-LAN interfaces.
$downlines .= sprintf("echo \"Disabling %s from %s\"", $iface, $inet);
$downlines .= sprintf("\n $DEVCON disable '%s'" , $dev_map{$iface});
}
return ($uplines, $downlines);
......
......@@ -189,19 +189,32 @@ while ($dirent = readdir(ETC)) {
closedir(ETC);
print "Updating /etc/motd.\n";
my $vname = "";
if (open(NICK, TMNICKNAME)) {
$vname = <NICK>;
$vname =~ s/\..*//;
close(NICK);
}
if (open(MOTD, ">/etc/motd")) {
open(UNAME, "uname -sr |");
my $uname = <UNAME>;
chomp $uname;
close(UNAME);
print MOTD "Windows-XP + " . $uname . " updated " . localtime();
printf MOTD "%s, Windows-XP + %s, %s\n", $vname, $uname, scalar(localtime());
print MOTD "\n\nWelcome to Windows in Emulab!\n\n";
close(MOTD);
}
else {
warn("Could not open /etc/motd!\n");
}
print "Cleaning out sp2 & Windows Update dirs.\n";
system("du -s -m C:/WINDOWS/\\\$*");
system("du -sm C:/WINDOWS/\\\$*");
system("rm -rf C:/WINDOWS/\\\$*");
system("du -sm C:/WINDOWS/ServicePackFiles/i386");
system("rm -rf C:/WINDOWS/ServicePackFiles/i386");
system("du -sm C:/WINDOWS/SoftwareDistribution/Download");
system("rm -rf C:/WINDOWS/SoftwareDistribution/Download/*");
print "Re-enable all network interfaces."
devcon enable =net 'PCI*'
......@@ -29,6 +29,8 @@ nbtif=$svcs/NetBT/$pi
for ifc in `regtool list $nbtif`; do
# Set the NetBT interface NetbiosOptions to Disable (2.)
regtool set -i $nbtif/$ifc/NetbiosOptions 2
# Also turn off outgoing DNS registration traffic.
regtool set -i $nbtif/$ifc/DisableDynamicUpdate 1
done
# Make sure the computer name is right. Reboots to change it if necessary.
......@@ -105,7 +107,7 @@ netsh interface reset all
# Windows DHCP doesn't make a /etc/resolv.h, which tmcc needs for bossinfo.
# Make one from ipconfig output.
ipconfig /all | awk \
ipconfig /all | tr -d '\r' | awk \
'/^ *Connection-specific DNS Suffix.*: ./{print "search", $NF} \
/^ *DNS Servers/{print "nameserver", $NF}' > /etc/resolv.conf
......@@ -114,18 +116,54 @@ ipconfig /all | awk \
domain=`tmcc bossinfo | sed -n 's/[^.]*\.\([^ ]*\) .*/\1/p'`
regtool set -s /HKLM/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain $domain
# Make sure all NIC's are up at the start, so they show up on ifconfig.
devcon enable =net 'PCI*'
# Cache getmac output while all interfaces are still enabled. Used by rc.ifconfig .
bootdir=/var/emulab/boot
getmac /nh /v /fo csv > $bootdir/getmac-cache
# Remember the control net interface MAC address and Local Area Connection name for
# slothd. It's the one whose IP address is returned by looking up the nodeid (pc%d).
cif=/var/emulab/boot/controlif
ipaddr=`nslookup $nodeid.$domain | awk 'NR>2 && /Address:/{print $2}'`
ipconfig /all | tr -d '\r' | awk \
'/^Ethernet adapter/{ ifc = gensub("Ethernet adapter (.*):", "\\1", 1); next }\
/Physical Address/{ gsub("-", ":"); mac = tolower($NF); next}\
/IP Address/ && $NF=="'$ipaddr'"{ print mac, ifc > "'$cif'"; exit }'
if [ -z "$ipaddr" ]; then
datehost="`date`: Host name '$hostname'"
msg="$datehost No ip address found for '$nodeid.$domain'."
echo "$msg" >> $logfile
echo "$msg"
else
# Remember the non-control net interface device descriptions, etc.
xid=$bootdir/xif_descrs xim=$bootdir/xif_macs xin=$bootdir/xif_names
ipconfig /all | tr -d '\r' | awk \
'/^Ethernet adapter/{ ifc = gensub("Ethernet adapter (.*):", "\\1", 1); next }\
/Description/{ gsub("^[^:]*: ", ""); descr = $0; next }\
/Physical Address/{ gsub("-", ":"); mac = tolower($NF); next }\
/IP Address/ && $NF=="'$ipaddr'"{ ctl=1; print mac, ifc > "'$cif'"; next }\
# Blank lines between device sections in ifconfig output.\
/^$/ && descr != "" { if (!ctl) do_xif(); descr = ctl = ""; next }\
END{ if (!ctl) do_xif() }\
function do_xif() {\
print mac > "'$xim'"; print ifc > "'$xin'"; print descr > "'$xid'" }'
# Disable all NICs except the control net interface. Experimental net interfaces
# will be enabled by $bootdir/rc.ifc later. (Generated by rc.ifconfig .)
xii=$bootdir/xif_ids
# 'devcon find' returns device_instance_ID: device description.
# Make the device id order the same as ipconfig for pasting files together.
devcon find =net 'PCI*' | sed 's/ *: */:/' | awk -F : \
'BEGIN{ while ((getline descr < "'$xid'") > 0) descrs[++n] = descr }\
{ ids[$2] = $1 }\
END { for (i=1; i<=n; i++) print "@"ids[descrs[i]] > "'$xii'" }'
# 'devcon disable' takes device_instance_ID args with leading @ signs.
devcon disable `cat $xii`
# Map from device names to instance id's for liblocsetup.pm:os_ifconfig_line().
ximap=$bootdir/xif_map
paste -d: $xin $xii > $ximap
fi
# Start up the service which will deliver a SHUTDOWN state event on reboot.
cygrunsrv -S EmulabShutdown
# The status 0 from this echo masks any failure of the above cygrunsrv.
echo rc.cygwin finished.
......@@ -42,7 +42,8 @@ alias v='ls -lsF'
. Make sure you turn on Remote Desktop logins under Control Panel / System / Remote (!)
. Go into Control Panel / Power Options / Hibernate, and make sure it's disabled.
This will gives you extra gigs of disk space on C: equal to your RAM size .
This will give you extra gigs of disk space on C: equal to your RAM size .
Also set Power Options / Power Schemes to "Always On".
. Set the workgroup name to EMULAB in Control Panel/System/Computer Name/Change...
No need to reboot yet if you have more to do.
......@@ -415,7 +416,7 @@ daFluxGroup
tar cfz /share/windows/boost-include.tgz boost
# [On Boss.]
sudo scp -rp /share/windows/{mysql,boost}-include.tgz root@pc$pc":"/tmp
sudo scp -rp /share/windows/{WSName,addusers,usrtogrp,setx}.exe root@pc$pc":"/tmp
sudo scp -rp /share/windows/{WSName,addusers,usrtogrp,setx,devcon}.exe root@pc$pc":"/tmp
# [On the target.]
mkdir /usr/local/include
cd /usr/local/include
......@@ -681,9 +682,9 @@ q
# Get the downloaded binary programs into the source tree for install.
ls -l ~/flux/testbed/tmcd/cygwinxp/*.exe
# [On boss:]
sudo scp -rp /share/windows/{WSName,addusers,usrtogrp,setx}.exe root@pc$pc":"/tmp
sudo scp -rp /share/windows/{WSName,addusers,usrtogrp,setx,devcon}.exe root@pc$pc":"/tmp
# [Back on the client:]
cp -p /tmp/{WSName,addusers,usrtogrp,setx}.exe ~/flux/testbed/tmcd/cygwinxp
cp -p /tmp/{WSName,addusers,usrtogrp,setx,devcon}.exe ~/flux/testbed/tmcd/cygwinxp
# Finally ready to do the Emulab makes!
mkdir ~/flux/obj-real
......@@ -952,6 +953,11 @@ if [ ]; then
tail -f /var/run/ldavg.csv
# The first one is always 99.999, etc.
. Disable TCP/IP address autoconfiguration, so unswitched interfaces like the sixth NICs
on the pc3000's don't get Microsoft class B network 169.254 addresses assigned.
svcs=/HKLM/SYSTEM/CurrentControlSet/Services tcpp=$svcs/Tcpip/Parameters
regtool set -i $tcpp/IPAutoconfigurationEnabled 0
. Reboot to make sure it all works right. Note that prepare clears out the source
trees, so don't do it until you've booted once and know that everything else works.
prepare
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment