EMULAB Setup in Orbit Project
[Installation & Setup | Components & Function | Analysis of Design | Patch
& BugFix | Reference]
Working Group:
Basic install procedures
- Install FreeBSD on the control nodes ( Boss and Ops) and test
nodes.
- Configure Network
- Install sourcecode from EMULAB
- Test basic functions.
Extra Solution Packages
- All extra source code, packages are currently located in the home
directory of Zhibin Wu, subdirectory name is to_common.
Reference:
adding_nodes.txt multiplexed-links.txt setup.txt
arch-hier.txt newimage.txt testing.txt
arch.txt nextimage.txt tftpboot-setup.txt
boot-scaling-issues.txt overview.txt tipserver.txt
cisco-voodoo.txt security.txt tipwithoutops.txt
dbtoir.txt setup-cisco.txt uk-image.txt
errorcodes.txt setup-db.txt updating-RHL.txt
ip-assumptions.txt setup-network.txt vnode-impl.txt
kernel-patches.txt setup-nodes.txt webglimpse.txt
linux-kernel.txt setup-ops.txt
Acronyms
Test Node Diagram
Disk Partition in FreeBSD
It is required that in Boss machine, \var partitions must be larger
than 100MB and /usr partition should be at least 2G. Using "df" command
to check.
#df
Filesystem
1K-blocks Used Avail Capacity
Mounted on
/dev/ad0s1a
128990 76198 42474 64%
/
/dev/ad0s1f
257998 1262 236098
1% /tmp
/dev/ad0s1g
74232440 1536862 66756984 2% /usr
/dev/ad0s1e
257998 9624 227736
4% /var
procfs
4 4
0 100% /proc
Enable SSH service in Boss && Ops
To start up this, just add an line in \etc\rc.conf
sshd_program="/usr/sbin/sshd"
Configure IP addresses
a) DHCP
ifconfig_em0='dhcp'
dhcp_flags ='yes' (for boss server)
b) fixed IP address configuration
ifconfig_fxp0=" inet
10.0.0.2 netmask 255.255.255.0"
defaultrouter =" 10.0.0.1"
c) edit etc/hosts and etc/resolv.conf files
To make the KDE display look better, it is better to configure XFree86
with two extra lines:
defaultdepth = 24
.......
Modes = "1024x768"
To start KDE when "startx", create a file .xinitrc in /root with 1 line code
"startkde".
FreeBSD Kernel Configuration file is loacted in /usr/src/sys/i386/conf directory
Serial Console
is a basic method to diagnoses the system when Ethernet port does not work.
Basically, default console is "internal" means "screen"(of monitor).
1. Purpose of Boot loader
During initialization, the loader will probe for a console and for disks,
and figure out what disk it is booting from. It will set variables accordingly,
and an interpreter is started where user commands can be passed from a script
or interactively.
The loader will then read /boot/loader.rc, which
by default reads in /boot/defaults/loader.conf which
sets reasonable defaults for variables and reads /boot/loader.conf
for local changes to those variables. loader.rc
then acts on these variables, loading whichever modules and kernel are selected.
In FreeBSD, You have to make a file called boot.config
containing /boot/loader -h. All this does is pass
a flag to the bootloader to boot into a serial console.
# echo "/boot/loader -h" > boot.config
And, the other way is to specify the boot loader and the kernel to use
the serial console by writing just one line in /boot/loader.rc:
set console=comconsole
This will take effect regardless of the settings in the boot block discussed
in the previous section.
To make a login prompt on serial console, you have to
Open the file /etc/ttys with an editor and locate
the lines:
ttyd0 "/usr/libexec/getty std.9600" unknown off secure
ttyd1 "/usr/libexec/getty std.9600" unknown off secure
ttyd2 "/usr/libexec/getty std.9600" unknown off secure
ttyd3 "/usr/libexec/getty std.9600" unknown off secure
ttyd0 through ttyd3 corresponds
to COM1 through COM4.
Change off to on for the
desired port.
More sophisticated technique for serial console: If you want all messages
re-direcred to SERIAL port, the BIOS of motherboard must support it. So, generally,
I do folowing on test node1 to get a Console both on COM1 and Video console.
My notes on getting a serial console at 115200
-must be com1 -com1 must be at port 0x3F8 irq 4 -in bios set the port and irq as above -in bios set serial redirection to com1 -in bios set baud rate 115200 -in bios set RTS/CTS flow control (optional) -edit (or create) /etc/make.conf to add these lines: BOOT_COMCONSOLE_PORT= 0x3F8 BOOT_COMCONSOLE_SPEED= 115200 -cd /sys/boot -make clean -make -make install -fdisk -B No im not kidding. Part of the boot knowing baud rate loader lives in the main disk boot block. -cd /boot -edit loader.conf -add a line: console=comconsole -edit /boot.config make it read (with a return after it): -Dh (the above is minus D h return, thats 4 characters) -cd /usr/src/sys/i386/conf -edit GENERIC (or whatever your kernconf is called) -add: options CONSPEED=115200 # Console Redirection -cd /usr/src -make buildkernel KERNCONF=GENERIC -make installkernel KERNCONF=GENERIC -open /etc/ttys -change ttyd0 "/usr/libexec/getty std.9600" unknown off secure" to "115200" "vt100" and "on" -reboot
|
Configure Switches:
1. Connect new Cisco 2950 switch to a serial console
FreeBSD COM port is named as "sio0" which is mapped to /dev/ttyd0
Using minicom and a serial cabel connected to the CONSOLE port of the back
panel of the CISCO Switch. Basic serial port setting in minicom is 8N1,
9600bps and No hw and Sw flow control.
Then it will prompt you the configuration questions:
- Enable Secret Password: *******523
- Enable Password *******524
- Terminal Password *******523
And, then configure management IP Address as: (display in minicom
console)
Enter interface
name used to connect to the
management network
from the above interface summary: vlan1
Configuring
interface Vlan1:
Configure
IP on this interface? [yes]: yes
IP address for this interface: 10.0.0.254
Subnet mask for this interface [255.0.0.0] :
Class A network is 10.0.0.0, 8 subnet bits; mask is /8
Would you like
to enable as a cluster command switch? [yes/no]: no
After that, the switch will build a initial configuration. And, then
we can connect any port of the switch with a Ethernet cable, to a terminal
port with address in same IP segment.
For example, I am using "10.8.0.1" in fxp0 of boss node, then "10.8.0.254"
will work.
The hostname of the switch is set to "data0"
2. About Control Switch ( Cisco 2900)
Enable Secret Password: ?????
Enable Password : **23
Terminal Password *******3
Enable PortFast in Control Switch
- telnet 10.0.0.254, type password
- enable, type password
- show mac-address-table, find the port connected to the node
- configure
- interface fa0/9
- spantree portfast
System Diagram && Hardware
in Network:
- D-Link Firewall
- Cisco 2900 (used as a control switch)
- Cisco 2950 ( used as a data switch)
- Terminal Server
10.0.0.1 ------ D-link Firewall. (192.168.120.131)
10.0.0.2 ------ Boss Server.
(192.168.120.132)
10.0.0.3 ------- Ops Server. (192.168.120.133)
10.0.0.10 ----- 10.0.0.254 range (divided to small ranges)
10.0.0.254 ----- Control Switch ( Cisco -2900XL)
Begin with 10.1.0.0..... DMZ range for data switch
VLAN on Control Switch?
Instructions from Utah, attached as setup-network.txt
##### Splitting up the control net
We basically have 5 VLANs on the control network: 'external' contains our connection to the outside world 'private' contains the boss node, and our backup server 'public' contains our ops node 'control' contains the control net interfaces of all experimental nodes 'control-hardware' contains all IP-controllable devices (namely, power controllers and switch IP interfaces, as well as a second interface on the boss node. This VLAN uses private IP addresses, and does NOT contain a router interface.
This is done for security - we route (using a module in our control-net switch) between these VLANs, and do some firewalling between each of them. The main goals are: 1) Protect both control and experimental nodes from the outside world (and vice-versa - we don't want people attacking the outside world from our nodes) 2) Protect the control nodes from the experimental nodes 3) Protect the control hardware (power controllers, etc.) from nodes and the outside world 4) Protect the boss node (which is _not_ publically accessible) from the ops node (which all experimenters have shells on.)
Now, it's entirely possible to combine these VLANs into one big one - this is what we've done on our mini-testbed here. But, there are some serious security implications with doing it this way - namely, that the nodes can theoretically impersonate each other, power cycle each other, and all kinds of nasty things.
At the very least, you should have a firewall between your testbed and the outside world, to satisfy #1.
|
So, vlan is used to separate one switch into several independent switches.
Router or ( A router-like machine with multiple ports) is across those
VLANs.
As we have no routing module in 2900XL. we don't need create those
vlans.
Configure
D-Link Firewall
username: admin
password: *****523
LAN zone:
- IP address: 10.0.0.1
- Netmask: 255.255.0.0
External to Internet:
- IP addr: 192.168.120.131
- Netmask: 255.255.255.0
- Gateway: 192.168.120.1
- DNS1:
- DNS2:
DMZ zone:
- IP addr: 10.1.0.1
- Netmsk : 255.255.0.0.
Disable DHCP service (Important!)
Mapping 192.168.120.132 ----> 10.0.0.2
Mapping 192.168.120.133 ----> 10.0.0.3
Service Setup:
Outgoing: Any for all options
Incoming: HTTP & HTTPS for 192.168.120.132 and SSH for 192.168.120.133.
So, with this configuration, the ping service is not provided to outsiders.
And, in internal machines, you will not hear any reply if you ping "www.google.com"
or other websites.
Configure DHCP server on Boss
"isc-dhcp-3.0" is installed with the FreeBSD package. as there is already
a file "2.dhcpd.sh" in the /usr/local/etc/rc.d/ directory, we only need
to create a "dhcpd.conf" file in /usr/local/etc/ directory, set IP range
as 10.0.0.5.-10.0.0.15. First we change a templete file. Then,
generate the real conf file with following command:
/usr/testbed/sbin/dhcpd_makeconf dhcpd.conf.template > dhcpd.conf
The port 67 will be used for DHCP and proxydhcp will occupy this port if
it get loaded first. So, be sure to start dhcp first. (Refer to the PXEBOOT ). This is done by the
differnent .sh files with a number perfix in/usr/loca/etc/rc.d directory.
The DNS is running first with the "1.named.sh" and DHCP is second as "2.dhcpd.sh".
When a new test node is added to Testbed, the web script will change
the dhcpd.conf file to adding the new IP addr as a fixed IP for the new node.
So, "chmod +w dhcpd.conf ", So it could be aceessed by the administor
of Orbit-lab ( "orbitadm").
Terminal
Server
IP address has to be set through the "webpage" method if it is already
configured an IP address. new IP address is set as 10.0.0.253.And the username
is root, password is w*****. Connecting to serial ports, a "null modem" cable
must be used. The ports are configured as "realport","115200 8N1". The command
to use each port is "connect x".
x is the port number. Use" kill x"
to close connection. And "Ctrl-[ + Enter"
to exit if the session is dead.
Configure
and Install Ops:
Making directories: /usr/testbed, /usr/proj, /usr/users/ ,/usr/groups/,
/share. Basically, /usr partition in Ops is very large as 75G, we are going
to mapping all /proj/ and /users/ directory in this partition. Make symbolic
links:
ln -s /usr/users /users
ln -s /usr/proj /proj
ln -s /usr/groups /groups
The
defs files
They incudes some description of set-up environment. You can put it anywhere.
but include the whole path when you do "configure" .
So, I copy the defs-example from sourcecode ( the snapshot) to /usr/users/zhibinwu/testbed/ directory and then
modified it.
Thare are tow major parts in defs-example. One is about the hostnames,
change them to ".......orbit-lab.org". WWW server is named as "www.example.orbit-lab.org".
And the other is of file systems. Give the whole path of some file system
we created above in this file. And rename it as defs-orbit.
The information in defs file are used to generate scripts and shell
programmers with those parameters. such as the domain names.
Build and Install
use the ~/tbobj directory to do my builds in. This is the "object
directory". And all sourcecode are placed in the /users/zhibinwu/testbed/
directory. So do configure as:
ops# cd ~/tbobj
ops# /users/zhibinwu/testbed/configure --with-TBDEFS=/users/zhibinwu/testbed/defs-orbit
install:
ops# cd install
ops# chmod 744 ops-iustall
ops# ./ops-install
A lot of problems encountered in the ops-install process. The ops-install
script is just quite straight forward to do a series of tasks. Some tasks
are not proceeded smoothly.
Comment files of port-install
When it proceeds to install ports. There is going to copy the testbed/install/ports/
* to /usr/ports/misc/ (under default port directory of FreeBSD). However,
there is a incompatible issue. In the "snapshots" from Emulab, the variable
COMMENT is undeclared in the Makefile. And there is a separate file
including the content of comment as named "pkg-comment". This is no
longer valid now. So, I get new "portmakefiles" from Emulab..(
put in /common directory of WINLAB). Update those Makefile and remove "pkg-comment"
files.
And I need to get two additional source files from
EMULAB of "elvind4.0.3.tar.gz" and "libelvin4.0.3.tar.gz"
Those should be stored locally in /usr/ports/distfiles/
Then, the ops-install would be succeed like this:
Creating admin group [ Skipped ] Setting directory permissions | /usr/testbed [ Skipped ] | /users [ Skipped ] | /proj [ Skipped ] | /groups [ Skipped ] | /share [ Skipped ] +-----------------------------------------------> [ Skipped ] Installing ports | Copying ports into place [ Skipped ] | Installing ports (may take a while) [ Succeeded ] +-----------------------------------------------> [ Succeeded ] Adding testbed content to rc.conf [ Succeeded ] Configuring sendmail | Setting up /etc/mail/local-host-names [ Succeeded ] | Setting up mailing lists | | Creating /etc/mail/lists [ Succeeded ] | | Creating mailing list files | | | testbed-ops [ Succeeded ] | | | testbed-logs [ Succeeded ] | | | testbed-www [ Succeeded ] | | | testbed-approval [ Succeeded ] | | | testbed-audit [ Succeeded ] | | | testbed-stated [ Succeeded ] | | | testbed-testsuite [ Succeeded ] | | +-------------------------------------------> [ Succeeded ] | | Adding lists to /etc/mail/aliases [ Succeeded ] | | Running newaliases [ Succeeded ] | +---------------------------------------------> [ Succeeded ] +-----------------------------------------------> [ Succeeded ] Setting up exports | Creating /etc/exports.head [ Succeeded ] | HUPing mountd [ Skipped ] +-----------------------------------------------> [ Succeeded ] Setting up syslog | Editing /etc/syslog.conf [ Succeeded ] | Creating /var/log/tiplogs [ Succeeded ] | Creating log files | | /var/log/logins [ Succeeded ] | | /var/log/tiplogs/capture.log [ Succeeded ] | | /var/log/mountd.log [ Succeeded ] | +---------------------------------------------> [ Succeeded ] | Setting up /etc/newsyslog.conf [ Succeeded ] +-----------------------------------------------> [ Succeeded ] Adding cron jobs | Editing /etc/crontab [ Succeeded ] | HUPing cron [ Succeeded ] +-----------------------------------------------> [ Succeeded ] Editing /usr/local/etc/sudoers [ Succeeded ] Allowing root ssh [ Succeeded ] Setting up capture | Creating /etc/rc.local [ Succeeded ] | Creating /usr/testbed/etc [ Succeeded ] | Creating empty /usr/testbed/etc/rc.capture [ Succeeded ] +-----------------------------------------------> [ Succeeded ] ---------------------------------------------------------------------- Installation completed succesfully! Please reboot this machine before proceeding with boss setup Local mailing lists have been created, with no members, in /etc/mail/lists . Please add members to the following lists: testbed-ops@orbit-lab.org testbed-logs@orbit-lab.org testbed-www@orbit-lab.org testbed-approval@orbit-lab.org testbed-audit@orbit-lab.org testbed-stated@orbit-lab.org testbed-testsuite@orbit-lab.org
|
Install sourcecode ( EMulab software)
on Ops:
The GNUmakefile in the object directory is used to make Emulab software,
for example. it compiles the sourcecode into some directories as:
ops-install:
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C security control-install
@$(MAKE) -C tip control-install
# @$(MAKE) -C os control-install
@$(MAKE) -C db control-install
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C utils control-install
@$(MAKE) -C event control-install
Correspondingly, the tasks of "control-install" is defined in GNUmakefile
in each directory
Boss Installation: Step by Step
It has been proved that ports install is a rocky process with
FreeBSD 4.9
- The first problem is that the "boost" software
has some problem: By visiting the webpage: http://www.freshports.org/devel/boost
.We download correct files from CVS. we need 5 files totally ( which
are to be put into /usr/ports/devel/boost/ ) For instance, we need to install
boost_1.30.2 instead of boost 1.30.0. And a new Makefile is needed to handle
a build bug which is related to Python version.
- Makefile (version: 1.11)
- distinfo
- files/ gcc-custom-tools.jam
- files/gcc-tools.jam.diff
- files/patch-gcc.hpp
- The second port-problem is related to perl-DB.
The make-install process stopped in the prompt:
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/
DBI.pm - not
found
===>
Verifying install for
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBI.pm
in
/usr/ports/databases/p5-DBI
===> p5-DBI-1.38 Please install
databases/p5-DBI-137
and try again.
|
Apparently, the name of the FreeBSD port has changed - because of the particular
version of perl, it needs a specific version of the DBI package. So, My solution
is go to /usr/ports/databases/p5-DBI-137/ , then do "make" and "make install"
it. Then it will be OK. The more sutiable solution is to change the Makefile.
( Makefile in /usr/ports/misc/emulab_boss/ directory)
- The third port-problem is that the ucd-snmp-4.2.6
is "borken" from the ports. As there are compile erros in the sourcecode of
snmp, we have no way to go through it. Finally, we got a package from
http://www.emulab.net/downloads/ucd-snmp-4.2.6_3.tgz.
And then as it is a binary package. we use 'pkg_add <filename>'
to install it. Then seems all things are OK.
- And, finally, the make install of ports
in boss finished as this:
-------------------------------------------------
===> emulab-boss-1.4 depends on shared library: gd.4 - found
===> emulab-boss-1.4 depends on shared library: lthread.2
- found
===> emulab-boss-1.4 depends on shared library: mhash.2
- found
===> emulab-boss-1.4 depends on shared library: mysqlclient.10
- found
===> emulab-boss-1.4 depends on shared library: snmp.4 -
found
===> emulab-boss-1.4 depends on shared library: vin4.2 -
found
===> Generating temporary packing list
===> Checking if misc/emulab-boss already installed
===> Registering installation for emulab-boss-1.4
emulab-boss-1.4: "/usr/ports/graphics/gd2" non-existent -- dependency list
incomplete
emulab-boss-1.4: "/usr/ports/net/bind9" non-existent -- dependency list
incomplete
boss #
------------------------------------------------------------------- |
Also, during the posrt-install process. it prompts to download PDFLib and
put in /usr/ports/distfiles/ directory. Seems the ports install process is
still incomplete. Two more ports
problems are related to "gd2" and "bind9". The right directories are in "/gd2"
and "usr/ports/dns/bind9" directory respectively. So, a new version of Makefile
is created to correct this.
Database Filling:
- Firstuser script. Run "utils/firstuser"
in object directory. It happens that the script does not recognize field with
"quota" character. So, database insertion could fail becasue of this. A new
"firstuser.in" is given from UTAH and should be put into sourcecode.
To remove wrong record
> mysql tbdb mysql> delete from users where uid='zhibinwu'; boss# ./firstuser IMPORTANT: You should ONLY use this script to create the first testbed user - others should be created through the web interface New username (you): zhibinwu User already exists, using existing user information New project pid: emulab-ops New project description: EMULAB dummy project Creating user/project: Are you sure? (Y/N) Y Creating user in database... Creating project in database... Creating group in database... Putting user in group... Running mkproj... *** /usr/testbed/sbin/mkproj: Please do not run this as root! Its already setuid! Running mkgrp... *** /usr/testbed/sbin/mkgroup: Please do not run this as root! Its already setuid! Running mkacct... *** /usr/testbed/sbin/tbacct: Please do not run this as root! Its already setuid! User created. Once the web page is up, you should be able to log in as the user you just created. Make sure to go to the user and project pages, and fill out information such as phone number, web URLs, etc.
|
and it occurs that the "firstuser" script is NOT flawless!. The firstuser has to be
run by a non-root user. As shown above, the "mkproj" script aborted becasue
of the "root" account. And if a non-root user of boss wants to create himeself
as the first emulab user, it should not be a normal user of ops machine (otherwise,
it will fail....). Then we found the "firstuser" script is going to create
the same user account in Ops machine through SSH with home directory listed
as /users/?????/. At this point, the "firstuser" script will fail to set the
password of user account in ops machine. To solve this, we have to comment
out the "FATALABORT" line of "chpswd" in "tbacct" script. Then, the first-user
will corretly set-up the user accont and project directory ("\proj\emulab-ops").
Now, it left two unsolved problems. The "user" table in database
has wrong passwd field, it is a "*" character instead of the shadow passed
like "9xijVtrmJoN.2 ". So, we have
to manully update the usr_pswd field of the database through MySQL. The other
problem is that the password of the new user in OPS server is not set. We
have to set passwd of new user account of the ops with root. Perhaps, the only way "firstuser" could proceed
smoothly is that a non-root superuser setup another user as the "firstuser".
- Mailing-lists. The WWW server scripts
will send out mails to testbed users in the mailing list. Now, those accounts
are all set in ops.orbit-lab.org. However, as the mail server "orbit-lab.org"
is not set. Thus, mails are bounced back into the "root" mailbox of BOSS
server. To fixed this problem , we have to change defs( remember "defs-orbit"???)
file and re do the installation of boss. As all ports problem
has already been fixed., This will not take much time. after modify the mailing
addresses in the defs file, the steps are:
cd ~/tbobj ~/orbit_source/testbed/configure --with-TBDEFS=/home/zhibinwu/testbed/defs-orbit gmake gmake boss-install sudo gmake post-install
|
It seems that not all things are refreshed automatically, the mailing address
in \usr\lcoal\etc\apache\httpd.conf is not changed. But anyway, the mailing
list is now re-directed to testebed-****@ops.orbit-lab.org. It also seems unnecessary to re-install ops
becasue the mailing address are not used by programs on ops server.
- Starting a new project "testbed"
amd add three experiments to the project "emulab-ops".
- Webdb. In /usr/testbed/www/webdb/ directory. The link is https://boss.orbit-lab.org/webdb/webdb.php3
. Only the user "orbitadmin" (first user as administrator) has the permission
to use it.
- Database backup error. the problem is that mysql can't write its
own log files. So. do following and the update.index file will appear in
the log/mysql/ directory.
#chown mysql /usr/testbed/log/mysql #cd /usr/local/etc/rc.d #./2.mysql-server.sh stop mysqldboss# ./2.mysql-server.sh start
|
- Adding Nodes in the database. This is done by manullay add an entry
"pc" in the node-type table
- Some useful SQL syntax for MySQL
databases
#mysql> use tbdb; #mysql> show tables; #mysql> update wires set port1=2 where .... #mysql> desc vlans; #mysql> insert nodes ( ) values ( );
|
Install Nodes
Power Controller Install:
- Three componets in the power control set. DS-72, DS-74 and RPC-14.
The DS-72 module has an optional SNMP agent which is enabled. We can set four
IP address for the 4 serial ports of DS-74 through thte configuration menu
of DS-72. SNMP communication is executed by a script in BOSS (SNMP management
station).
- Agent use UDP port 162 to send trap alerts to Manager (in SNMP management
station) and Manager use UDP port 161 for read/write. The access to an agent
is restricted by the community. The manager sending a message to the agent
gives its community. The community defines what level of access the manager
have. Agents have to be configured in order to know one or more community,
and which right (level of access) each community owns. The default community
string in Emulab's script is "private".
- The file in Boss to control APC power controller is in "tbsetup/snmpit_apc.pm
". In this file, it uses the MIB file in /usr/local/share/snmp/mibs/PowerNet-MIB.txt
. However, this file does not exist in the source package. As
the MIB files are vendor-specific, we need MIB file from BayTech. The currect
MIB file is "bayuniv-4014-mib.txt". To make the RPC 14 's status appear
in SNMP query, you have to configure DS-74's port 1 as "RPC-SNMP" instead
of "RS-232".
- OID (Object Identifiers) is in a tree structure. SMI file (Structure
of Management Information) is inRFC1155-SMI.txt
. The OID string is "my $CtlOID = ".1.3.6.1.4.1.318.1.1.4.4.2.1.3";". This
is intepreted as a tree structure. as root.1(iso).3(identified orgnizations).6(dod).1(intenet).4(private).1(enterprise).318(apc)..........So
To set a OID for the Baytech, we need a new MIB file from the Baytech.
#!/usr/bin/perl -w
# # EMULAB-COPYRIGHT # Copyright (c) 2000-2003 University of Utah and the Flux Group. # All rights reserved. #
# # snmpit module for APC MasterSwitch power controllers # # supports new(ip), power(on|off|cyc[le],port) #
package snmpit_apc;
$| = 1; # Turn off line buffering on output
use SNMP; use strict;
sub new($$;$) { #usage new snmpit_apc($IP,$verbose); a constructor for the snmpit_apc class (Modules)
# The next two lines are some voodoo taken from perltoot(1) my $proto = shift; # the first argument is protocol name??? my $class = ref($proto) || $proto; #the first shift reads to class itself
my $devicename = shift; # the second argument is device name (IP address such as 10.0.0.252) my $debug = shift; #the last argument is debug mode (verbose)
if (!defined($debug)) { $debug = 0; # if the third parameter is not given, debug is set to zero }
if ($debug) { print "snmpit_apm module initializing... debug level $debug\n"; }
$SNMP::debugging = ($debug - 5) if $debug > 5; my $mibpath = "/usr/local/share/snmp/mibs"; &SNMP::addMibDirs($mibpath); &SNMP::addMibFiles("$mibpath/RFC1155-SMI.txt", "$mibpath/PowerNet-MIB.txt");
$SNMP::save_descriptions = 1; # must be set prior to mib initialization SNMP::initMib(); # parses default list of Mib modules $SNMP::use_enums = 1; #use enum values instead of only ints print "Opening SNMP session to $devicename..." if $debug; my $sess =new SNMP::Session(DestHost => $devicename, Community => 'private'); if (!defined($sess)) { warn("ERROR: Unable to connect to $devicename via SNMP\n"); return undef; }
my $self = {};
$self->{SESS} = $sess; $self->{DEBUG} = $debug; $self->{DEVICENAME} = $devicename;
bless($self,$class); # what is bless? Blessing associates a referent with a class # Once an object has been blessed, # calling the ref function on its reference returns the name of its class instead of the fundamental type of referent return $self; }
sub power { # a routine to power-on-off-reset the device, power [on|off|cycle] <node> [<node>] ... my $self = shift; my $op = shift; #get the option, on or off my @ports = @_; #this is to get the ports (outlets) # @_ is an Array tranfered to ports, also an array
my $CtlOID = ".1.3.6.1.4.1.318.1.1.4.4.2.1.3"; if ($op eq "on") { $op = "outletOn"; } elsif ($op eq "off") { $op = "outletOff"; } elsif ($op =~ /cyc/) { $op = "outletReboot";}
my $errors = 0;
foreach my $port (@ports) { print STDERR "**** Controlling port $port\n" if ($self->{DEBUG} > 1); if ($self->UpdateField($CtlOID,$port,$op)) { print STDERR "Outlet #$port control failed.\n"; $errors++; } }
return $errors; }
sub UpdateField { my ($self,$OID,$port,$val) = @_; # $self is the class itself, three arguments goes to four variables respectively
print "sess=$self->{SESS} $OID $port $val\n" if $self->{DEBUG} > 1;
my $Status = 0; my $retval;
print "Checking port $port of $self->{DEVICENAME} for $val..." if $self->{DEBUG}; $Status = $self->{SESS}->get([[$OID,$port]]); if (!defined $Status) { print STDERR "Port $port, change to $val: No answer from device\n"; return 1; } else { print "Okay.\nPort $port was $Status\n" if $self->{DEBUG}; if ($Status ne $val) { print "Setting $port to $val..." if $self->{DEBUG}; $retval = $self->{SESS}->set([[$OID,$port,$val,"INTEGER"]]); print "Set returned '$retval'" if $self->{DEBUG}; if ($retval) { return 0; } else { return 1; } } return 0; } }
# End with true 1;
|
- To modify this, first, locate the OID we want from the Baytech MIB
file, e.g. 1.3.6.1.4.1.4779.1.3.5..... is SFModulesRPC. To power-off a outlet
in a RPC, we need to specify the entry in a SFModulesRPCTable or just issue a group
command for "SFModulesRPCGroupCmd".
The OID for this one is "1.3.6.1.4.1.4779.1.3.5.4".
The command string, for example is "0 1.2", which means turn off the second
outlet of first RPC module. Now, the problem is to use "set" and "get". The
syntax to get a snmp response is
sub readmodnum { my $modnum = 0; my $self = shift; my $OID = ".1.3.6.1.4.1.4779.1.1.2"; #OID String for "sFIdentSerialNumber" $modnum = $self->{SESS}->get([$OID,0]); # 0 must be given as the 2nd para. print "Serial Number is $modnum via SNMP\n"; return 0;
} sub writemodname {
my $self = shift; my $OID = ".1.3.6.1.4.1.4779.1.1.3"; $self->{SESS}->set([$OID,0,"DS72","OCTETSTR"]); # 0 also must be given as the 2nd para. index?? return 0; }
|
the above will print " Serial Number
is 415699 via SNMP ".
- p5-SNMP 4.2.0: The basic operations offered by
SNMP are provided through an object oriented interface for modularity and
ease of use. The primary object is SNMP::Session which is implemented as
a blessed hash reference. The object supports 'get', 'set', and 'getNext'
method calls. All calls are blocking/synchronous (i.e., they must receive
a response or timeout before control is returned to the caller)
- snmpwalk -m bayuniv-4014-mib.txt
10.0.0.252 public .1.3.6.1.4.1.4779.
- Finally, we creat snmpit_ds72.pm
based on snmpit_apc.pm, we use
a new OID as ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1 " and the community string
as "public".Also, "power" script
has been modified. The type "APC" has been replaced with "DS72-RPC14", so
be sure to use this type for "powerctrl1' in "nodes" table.
Running Experiment
- First simple 2-node ns script:
set ns [new Simulator] source tb_compat.tcl
set node0 [$ns node] set node1 [$ns node]
set link0 [$ns duplex-link $node0 $node1 100Mb 0ms DropTail]
$ns rtproto Static
set udp0 [new Agent/UDP] $ns attach-agent $node0 $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0
set null0 [new Agent/Null] $ns attach-agent $node1 $null0
$ns connect $udp0 $null0 $ns at 1.0 "$cbr0 start"
$ns at 5.0 "$cbr0 stop"
$ns run
|
2 pcs will be assigned to this experiment. After tb-swap_in succeeded.
The new ip address assigned to the experiment interfaces of test nodes are
10.1.1.2 (pc1) and 10.1.1.3/ However, as default netmask is 255.255.255.0.
Those nodes could not talk to testswitch (10.1.0.254) directly, but through
the eth0 and control switch. To fix this problem, The experiment initially
failed before we fixed the testswitch. Then it seems OK. But the real problem
is that experimetns cannot be run as normal as ns scirpt. We need monotor
the traffic with tcpdump ourselves.
It's better to have an NS-script to run just define the topology and re-loading
all the nodes. Then experimenters can run an End-to-End applicaiton and tcpdump.
To check the experiment status go to /usr/testbed/expwork/ directory.
Another simple loop ns-script example to do this is :
# This is a simple ns script that demonstrates loops. set ns [new Simulator] source tb_compat.tcl
set maxnodes 2 set lanstr ""
for {set i 1} {$i <= $maxnodes} {incr i} { set node($i) [$ns node] set name node-${i} append lanstr "$name " tb-set-node-os $node($i) FBSD-STD }
# Put all the nodes in a lan set big-lan [$ns make-lan "$lanstr" 100Mb 0ms]
$ns run
|
Test with delay Node
- There is a problem with the Catalyst 2950 switch. The SNMP bug in
IOS software make it impossoble to assign an port to a vlan when the cable
is plugged in that port. When upgraded to IOS 12.1(20) image in that switch,
the problem is solved. To mananlly test the vlan settings. We can use:
snmpset testswitch private vmVlan.9 integer 42
Test-node Diagram:
Acronyms
- APOD
- Authenticated ICMP Ping of Death
- IPOD
- ICMP Ping of Death
- GRUB
- Grand Unified Bootloader
- PXE
- Preboot eXecution Environment. is, in one persons words, Intel's attempt
at making PCs work more like SUNs ( ref). PXE outlines a protocol for enabling
the BIOS to retrieve the operating system over standard network protocols.
- TFTP
- Trivial File Transfer Protocol, a simple form of the File Transfer
Protocol (FTP). TFTP uses the User Datagram Protocol (UDP) and provides no
security features. It is often used by servers to boot diskless workstations,
X-terminals, and routers.
-
Last modified
Apr.6 2004, Zhibin Wu.