Telling IP from IPX in the Login Script
Novell Cool Solutions: Trench
By Brad Bendily
Digg This -
Posted: 18 Jan 2005
PROBLEM: I am still running a mixed environment of clients running IP and IPX. And I have NetWare 5.1 and NetWare 6.5 servers also running IP and IPX. Recently we've added a cluster to our main file server.
Since in order to use clustering technology you have to use IP, we needed a way to distinguish IP from IPX clients in the login scripts. This would allow us to have two different drive mapping statements in one login script, one for IP clients and one for IPX clients. And would allow us to be able to upgrade IPX clients to IP over time, but also allow us to start using the cluster drive mapping statements.
SOLUTION: To solve this problem I started looking at login script variables. There is not a variable that prints the IP address directly, but there is the "Network" variable. What I found in a couple of TIDs was that the "Network" variable is the IP or IPX address in HEX. I also found that you can offset the "Network" variable. Because the first 2 octets of our IP subnet never change, I knew that the first 4 characters of the offset would always be the same.
For example if your IP address is 192.168.12.45 then your "Network" variable would equal (in HEX) C0-A8-0C-2D. To see this in a login script you can add this to your login script:
Write "Network address = %network"
If your IP is 192.168.12.45 then the output of the above command would be
"Network address = C0A80C2D"
Now here's the fun part. I make a variable "ipnet". Add the next 5 lines to your login script:
set ipnet="%NETWORK" >> 4 write "%ipnet" if "%ipnet" = "C0A8" then map root h:=.clustervolume.context.ou.tree else map root h:=.ipxloginmethodhere.ou.tree end
Remember the C0A8 matches 192.168. You'll have to change that to match your subnet. The >> 4 part takes off the last 4 digits of the HEX address. If you change >> 4 to >> 2 then only two digits would come off and the example above would look like: "C0A80C"
The downside at this point is that any workstation logged in as IPX will not be able to access the volume if it has moved to another server because of a cluster migration.
(PS. any simple calculator can translate decimal to HEX and vise versa. Use KCalc or even the Windows Calc program.)
If you have any questions you may contact Brad at firstname.lastname@example.org
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com