Determining IP Subnet in Login Script
Articles and Tips: tip
01 Apr 2002
It is often useful to have the ability to check the network address of a user in the login script in order to avoid running commands that should not be used over a slow link. You should use this capability if you dial into the network via NIAS / NetWare Connect, or if you come into the network via a VPN connection.
The difficulty comes in pure IP logins, where you do not have an IPX network number. The IP address of the client is provided by the NETWORK_ADDRESS variable, but it is coverted to hexadecimal.
You can still use a pair of IF statements to determine if the client's network address is outside your internal network and branch, as shown in the following example. To check for a subnet of 192.168.0.X, you would use the statement:
IF %NETWORK_ADDRESS > "C0A80000" AND %NETWORK_ADDRESS < "C0A800FF"
This will find any IP address between 192.168.0.1 and 192.168.0.254. You can do the same thing with other IP subnets by converting each octet into a hexadecimal number (192 = C0, 168 = A8, etc). To get a bit fancier and look for both an IPX network number or an IP subnet, do the following:
IF %NETWORK_ADDRESS = "BADFACE" or (%NETWORK_ADDRESS > "C0A80000" AND %NETWORK_ADDRESS < "C0A800FF")
This will find any machines logging in from an IPX segment of BADFACE or from an IP subnet of 192.168.0.X.
* Originally published in Novell AppNotes
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.