Operating System - OpenVMS
1748134 Members
3437 Online
108758 Solutions
New Discussion юеВ

Re: Getting Network Mask Address

 
Vineet Deshpande
Frequent Advisor

Getting Network Mask Address

Hi,

I want to know if there is any DCL command which will give me the Network Mask address. I am getting it from "tcpip show interface" but this command won't work if MultiNet is present. Is there any generic command which will give me the Mask address?

Please help.

Thanks,

Vineet
8 REPLIES 8
Joseph Huber_1
Honored Contributor

Re: Getting Network Mask Address


Since TCP/IP is not generic in VMS, there is no generic interface. And there is no programming API I know of.

What comes nearest would be using "ifconfig -a"
and parse the output.
But the output format is still TCPIP stack dependent, so You have to write your own parsing (DCL-)program to extract the info wanted.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Getting Network Mask Address

And be aware:there is no such thing than "the" network mask:
each interface has its own, and will be different: if one IF is connected to the outside world, the another to the local LAN (e.g. a 10.* or 192.168.*.* network), then they certainly have different netmask and broadcast addresses.
http://www.mpp.mpg.de/~huber
Robert Gezelter
Honored Contributor

Re: Getting Network Mask Address

Vineet,

There is no universal DCL command to get the network address.

In Multinet, the information is generally accessed by looking at the configuration information by using the MULTINET CONFIGURE command.

- Bob Gezelter, http://www.rlgsc.com
Ian Miller.
Honored Contributor

Re: Getting Network Mask Address

For TCPWARE and MULTINET this data may be available in a logical name
____________________
Purely Personal Opinion
labadie_1
Honored Contributor

Re: Getting Network Mask Address

The following works with Alpha VMS 7.3-2 (and not Itanium :-)

$ @sys$startup:tcpip$define_commands
$ awk :== $ sys$common:[syshlp.examples.tcpip.snmp]gawk.exe
$ pipe ifconfig -a | awk/command="/broadcast/ {print $1}" sys$pipe

This will print the broadcast mask, not the network mask.
Joseph Huber_1
Honored Contributor

Re: Getting Network Mask Address

On my TCPIP system the following

pipe ifconfig -a | awk/command="/netmask/ {print $4}" sys$pipe

prints all netmasks on all interfaces.
http://www.mpp.mpg.de/~huber
labadie_1
Honored Contributor

Re: Getting Network Mask Address

Taking Joseph'idea, the following works if you have only a network card (but you get the idea)

$ pipe ifconfig -a | awk/command="/netmask/ {print $4}" sys$pipe | (read sys$pipe in ; def/job in &in)
$ x1=%X'f$extract(0,2,f$trn("in"))
$ x2=%X'f$extract(2,2,f$trn("in"))
$ x3=%X'f$extract(4,2,f$trn("in"))
$ x4=%X'f$extract(6,2,f$trn("in"))
$ res:='X1'"."'X2'"."'X3'"."'X4'
$ wr sys$output "the network mask is ''res'"
Hoff
Honored Contributor

Re: Getting Network Mask Address

This usually ends up involving prompting the user directly, or querying the lower-level IP stack APIs (the C socket library) within the application.

As for the request, please lodge a formal request with HP.

It is long past time that there be a DCL lexical function for this, and/or a DCL command interface that works with all of the IP stacks.

And FWIW as you proceed with this, remember that IPv6 is in play here, too. (Yes, there are OpenVMS systems running on IPv6 networks. More will be coming on-line, too.)