OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Jan-Erik Lärka on March 16, 2025, 04:16:38 pm

Title: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 16, 2025, 04:16:38 pm
I'm trying to write a REXX script to list the devices available on my home LAN.

It use commands available in the OS to get the host name, ip-number and mac address.

Here I can see on the names that it has found computers, mobile phones, vacuum cleaner, routers etc. on the same subnet and indicate if they're offline or not.
I'd also like to, if possible, find out what kind of device the script has listed and set icons accordingly, and not just online/offline. How?!

That also mean that I need help to create the artwork for it.  ;)

The script in default mode without parameters determine the ip-address of the computer, ping and check for others 1 to 255.
With environment variable SET WOL=1 it also send a "wake on lan call" to each machine.
With environment variable SET NET=1 it also create a folder Network Map* in the folder Network, with a sub folder for workgroup* or domain* and individual objects (online*/offline*) for each device. If one click on a device it will refresh (run the script and update the object itself).
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 23, 2025, 08:46:43 am
I've added a line to the script to open the folder as it refresh the devices.
Title: Re: [Classic REXX] Network Map
Post by: Neil Waldhauer on March 23, 2025, 02:29:19 pm
Here is does not find all computers in the local subnet, and seems to mostly be a reminder to clean out my hosts file.
It does find my router, which is not in the hosts file.
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 23, 2025, 06:22:26 pm
Here, it finds nothing. Manually testing, I can ping the wife's Roku stick, so would expect that to be found at 192.168.0.102, same with my phone at 192.168.0.103
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 24, 2025, 07:16:52 pm
Neil: Interesting, and you get anything else if you run the OS/2 commands (HOST, NETSTAT, PING and ARP) by hand?
Or should the script be adjusted to use some other parameter with the above commands?

The script determine the IP-number from the machine that run the script.
Dave: Can it be something like 192.168.0.101 for your machine?

The script PARSE away the last part and then PING 192.168.0.1 to 192.168.0.255 and follow that by listing each with ARP
Could you please add
Code: [Select]
call trace '?i'before the first line that begin with '@HOST and step through the code and tell us?

Some of the PARSE lines may very well need tweaking depending on wrong assumptions made
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 24, 2025, 09:00:12 pm
The script determine the IP-number from the machine that run the script.
Dave: Can it be something like 192.168.0.101 for your machine?

Either 192.168.0.101 or 192.168.0.100, yesterday it was 192.168.0.100

Quote
The script PARSE away the last part and then PING 192.168.0.1 to 192.168.0.255 and follow that by listing each with ARP
Could you please add
Code: [Select]
call trace '?i'before the first line that begin with '@HOST and step through the code and tell us?

Some of the PARSE lines may very well need tweaking depending on wrong assumptions made

Sure hard to redirect so copying and not including when I enter enter.
Code: [Select]
H:\tmp>macaddr.cmd
       >>>             "N"
   104 *-*           '@HOST' VALUE('HOSTNAME',, 'ENVIRONMENT') '2>&1|RXQUEUE';
       >L>             "@HOST"
       >L>             "HOSTNAME"
       >L>             "ENVIRONMENT"
       >F>             "ARCAOS-44454C4"
       >O>             "@HOST ARCAOS-44454C4"
       >L>             "2>&1|RXQUEUE"
       >O>             "@HOST ARCAOS-44454C4 2>&1|RXQUEUE"
       >>>             "@HOST ARCAOS-44454C4 2>&1|RXQUEUE"
       +++   Interactive trace. "Trace Off" to end debug, ENTER to Continue.

   105 *-*           Parse Value LINEIN('QUEUE:') With hostname.i ' = ' ipnumber.i;
       >L>             "QUEUE:"
       >F>             "HOST: unknown host ARCAOS-44454C4"
       >>>             "HOST: unknown host ARCAOS-44454C4"
       >C>             "HOSTNAME.1"
       >>>             "HOST: unknown host ARCAOS-44454C4"
       >C>             "IPNUMBER.1"
       >>>             ""

   106 *-*           last = STRIP(ipnumber.i);
       >C>             "IPNUMBER.1"
       >V>             ""
       >F>             ""
       >>>             ""

   107 *-*           j = 1;
       >L>             "1"
       >>>             "1"

   108 *-*           If VALUE('ACTIVE',, 'OS2ENVIRONMENT') = 1;
       >L>             "ACTIVE"
       >L>             "OS2ENVIRONMENT"
       >F>             ""
       >L>             "1"
       >O>             "0"
       >>>             "0"

   115 *-*           Else;
   116 *-*             Do;

   117 *-*               Parse Value last With major '.' minor '.' subnet '.' this;
       >V>                 ""
       >>>                 ""
       >>>                 ""
       >>>                 ""
       >>>                 ""
       >>>                 ""

   118 *-*               If DATATYPE(this, 'W');
       >V>                 ""
       >L>                 "W"
       >F>                 "0"
       >>>                 "0"

   126 *-*               End;
   127 *-*           hostname.0 = j - 1;
       >V>             "1"
       >L>             "1"
       >O>             "0"
       >>>             "0"

   128 *-*           End;
   134 *-*       j = 0;
       >L>         "0"
       >>>         "0"

   135 *-*       Do While QUEUED() > 0;
       >F>           "0"
       >L>           "0"
       >O>           "0"
       >>>           "0"
   136 *-*       Do i = 1 To hostname.0;
       >L>           "1"
       >>>           "1"
       >V>           "0"
       >>>           "0"
   172 *-*       Return retval;
       >V>         "0"
       >>>         "0"

H:\tmp>
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 24, 2025, 10:45:00 pm
If the host command in TCP/IP say it is unknown, then one can't do much about it in the script.
 
Anyone know why host can't retrieve it?
Is it some security setting in the router, a missing setting or ...?
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 25, 2025, 01:27:03 am
I added, first 127.0.0.1 ARCAOS-44454C4 to my hosts file, which was 4MB, then things went further but the script failed as it was pinging 27.0.0.x. Then I changed to a minimal hosts file with the same, it checked the 127.0.0.x range. Then I changed it to 192.168.0.100 ARCAOS-44454C4
Code: [Select]
H:\tmp>macaddr.cmd
ARCAOS-44454C4: 192.168.0.100: 70:20:84:0e:35:53
I guess I misunderstood what the script was supposed to do as I thought it would find all the machines on the local network, not just the ones in the hosts file.
Still a problem parsing the big hosts file, whether size or confusion from the ipv6 addresses I don't know.
You can get the hosts file,
Code: [Select]
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Arca Noae says not to use such a large hosts file, though it seems to work fine here. Its purpose is to block ads, Facebook etc.
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 25, 2025, 06:33:46 am
It is supposed to find all machines on the network, and here it does!

My hosts file on this newlt installed ArcaOS 5.0.7, read
127.0.0.1                localhost
and nothing else.
My router thus provide my machines with the information and ip-number through dhcp as the vacuum cleaner was introduced just days ago... and when the script run again it update the info (and icons, if SET NET=1 is active) and show that 2 devices has gone offline over the night.

So the question remain... why host command behave the way it does.

"DHCP Monitor" of course list the ip-address on LAN0 for you?
( Desktop\Computer\System Setup\Network\TCP/IP\DHCP Monitor )
Title: Re: [Classic REXX] Network Map
Post by: Neil Waldhauer on March 25, 2025, 02:28:23 pm
Neil: Interesting, and you get anything else if you run the OS/2 commands (HOST, NETSTAT, PING and ARP) by hand?
Or should the script be adjusted to use some other parameter with the above commands?

It seems that ping is returning only a few machines on the subnet. The printer, the thermostat, the lighting controllers do not respond. Only one phone and one tablet respond. I imagine if the others don't respond, there is not much you can do.
Title: Re: [Classic REXX] Network Map
Post by: Greg Pringle on March 25, 2025, 03:04:25 pm
My experience is that a number of devices do not respond to a broadcast ping. They will respond to a direct ping unless the device blocks it. So directly ping each address from 1 to 254 as in
ping 192.168.0.1
ping 192.168.0.2
ping 192.168.0.3
etc.
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 25, 2025, 03:55:06 pm
It is supposed to find all machines on the network, and here it does!

My hosts file on this newlt installed ArcaOS 5.0.7, read
127.0.0.1                localhost
and nothing else.
My router thus provide my machines with the information and ip-number through dhcp as the vacuum cleaner was introduced just days ago... and when the script run again it update the info (and icons, if SET NET=1 is active) and show that 2 devices has gone offline over the night.

So the question remain... why host command behave the way it does.

"DHCP Monitor" of course list the ip-address on LAN0 for you?
( Desktop\Computer\System Setup\Network\TCP/IP\DHCP Monitor )

DHCP Monitor shows my address as 192.168.0.106. My router doesn't show this. Possibly due the weird router/web thingy. I'm on a LTE connection and the router thing has a sim card and mostly uses WiFi for the local connections. MY OS/2 computer is plugged into the one lan port on the router thing.
I see the router doesn't list this computer on the device page. Later I should dig out my T42 and test with it as it does connect through wireless.
I can ping most of the machines on my net, perhaps the broadcast ping that Greg mentioned gets filtered.
Title: Re: [Classic REXX] Network Map
Post by: Andi B. on March 25, 2025, 06:41:25 pm
I've also seen it many times that a lot of devices do not respond to pings on broadcast address. OS/2 boxes are the only ones which always answers. But most other computers do not. I think no even all of my SoHo printers do.

There's a utility which pings every address. LanScan? Of course it takes time to get a full list especially with a network bigger than /24 (f.i. /16 - netmask 255.255.0.0).
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 26, 2025, 06:53:16 am
If the host command in TCP/IP say it is unknown, then one can't do much about it in the script.
 
Anyone know why host can't retrieve it?
Is it some security setting in the router, a missing setting or ...?

Same result as Daven nothing !
ArcaOS 5.1.1 default dhcp settings

What should ACTIVE be into 'OS2ENVIRONMENT'  ? nothing here

Should the ArcaOS be shared on the network or included into some workgroup ?
Only have my PC -  internet box on which other equipement are connected through ethernet or wifi on the same host network   
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 26, 2025, 07:21:13 am
Seen.

I have a specific ARCAOS host_name under config.sys
Into my box and because my PC can be booted OS/2 or Windows using same interface, I have set a name to the corresponding @ip / macaddr
Using nslookup on my PC @ip I could see that my computer_name set into the box differs from the config.sys and after updating config.sys, it works

With WOL=0 and NET=0, it display all local equipments.
When I set WOL=1, I have all equipment but also many
(icoplte    (icoplte    (icoplte    (icoplte    (icoplte    (icoplte ....

With NET=1, I have the folder created as well all found equipment but none have an icon !
Where are icon found ?

I would suggest a change into the rexx which could prevent this kind of no returned result.
Check the interface used and look for its @ip followed by a nslookup on the @ip which will return the hostname and then run into the process like if the
the host_name was found into os2env variables....

Title: Re: [Classic REXX] Network Map
Post by: Remy on March 26, 2025, 07:58:57 am
It is supposed to find all machines on the network, and here it does!

My hosts file on this newlt installed ArcaOS 5.0.7, read
127.0.0.1                localhost
and nothing else.
My router thus provide my machines with the information and ip-number through dhcp as the vacuum cleaner was introduced just days ago... and when the script run again it update the info (and icons, if SET NET=1 is active) and show that 2 devices has gone offline over the night.

So the question remain... why host command behave the way it does.

"DHCP Monitor" of course list the ip-address on LAN0 for you?
( Desktop\Computer\System Setup\Network\TCP/IP\DHCP Monitor )

DHCP Monitor shows my address as 192.168.0.106. My router doesn't show this. Possibly due the weird router/web thingy. I'm on a LTE connection and the router thing has a sim card and mostly uses WiFi for the local connections. MY OS/2 computer is plugged into the one lan port on the router thing.
I see the router doesn't list this computer on the device page. Later I should dig out my T42 and test with it as it does connect through wireless.
I can ping most of the machines on my net, perhaps the broadcast ping that Greg mentioned gets filtered.

Hi!

What is the name returned from a nslookup 192.168.0.106 ?
Is it the one under nostname from config.sys ?
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 26, 2025, 04:39:10 pm
Hi!

What is the name returned from a nslookup 192.168.0.106 ?
Is it the one under nostname from config.sys ?

Today, my machines address is 192.168.0.104,
Code: [Select]
H:\tmp>nslookup 192.168.0.104
*** Can't find server name for address 192.168.0.1: Non-existent host/domain
*** Default servers are not available

config.sys has,
Code: [Select]
SET HOSTNAME=ARCAOS-44454C4
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 26, 2025, 07:01:00 pm
Seen.

I have a specific ARCAOS host_name under config.sys
Into my box and because my PC can be booted OS/2 or Windows using same interface, I have set a name to the corresponding @ip / macaddr
Using nslookup on my PC @ip I could see that my computer_name set into the box differs from the config.sys and after updating config.sys, it works

With WOL=0 and NET=0, it display all local equipments.
When I set WOL=1, I have all equipment but also many
(icoplte    (icoplte    (icoplte    (icoplte    (icoplte    (icoplte ....

Remy, I've only been able to test with English version, is it possible that the parsing has to be adjusted somewhat?

With NET=1, I have the folder created as well all found equipment but none have an icon !
Where are icon found ?
That also mean that I need help to create the artwork for it.  ;)
But see the icons I use here.
I would suggest a change into the rexx which could prevent this kind of no returned result.
Check the interface used and look for its @ip followed by a nslookup on the @ip which will return the hostname and then run into the process like if the
the host_name was found into os2env variables....
That's something to fall back on, as several of you seem to not be able to get "host" to return proper info
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 26, 2025, 07:04:44 pm
I would say that that explain the problems.
*** Can't find server name for address 192.168.0.1: Non-existent host/domain
then no script can help until it's configured to reply with something useful.

Hi!

What is the name returned from a nslookup 192.168.0.106 ?
Is it the one under nostname from config.sys ?

Today, my machines address is 192.168.0.104,
Code: [Select]
H:\tmp>nslookup 192.168.0.104
*** Can't find server name for address 192.168.0.1: Non-existent host/domain
*** Default servers are not available

config.sys has,
Code: [Select]
SET HOSTNAME=ARCAOS-44454C4
Title: Re: [Classic REXX] Network Map
Post by: Andi B. on March 26, 2025, 08:33:16 pm
My limited understanding of all of these is as following -
nslookup needs a DNS server for a useful reply. There's usually no DNS server on your home network so it will not work with most small private LANs. And the official DNS servers on the internet don't know anything about your private network members of course. At least they shouldn't.

If you wanna have a private DNS server in your network you've to setup one. But most of the time it's not worth the effort to make this for a private LAN. If you've a router which run's a DHCP server it might work as local DNS server too. But then it probably don't know very much about your devices with static IPs.

I'm puzzling what you're all talking about here. In my limited understanding you need to ping every address on your subnet if you wanna have a list of all your devices on your LAN (with IP support. There maybe devices on the LAN communication without IP protocol). Even then it may be possible that a devices do not respond to an ping request. And so you don't 'see' it either. Although I don't think much devices will really hide them self when called with a ping.

If all your devices uses dynamic IP addresses then look at the leases file of your DHCP server. It has the IP <-> MAC list in the dhcpd.leases file. And sometimes there's also a hostname there for the device. But that's not mandatory. Also in a LAN with static IPs or a mixed LAN (I think that is very common) you only get the subset of devices with dynamic IPs. So pinging every IP is IMHO the only way to get a (nearly) complete list of all devices.

If you wanna have a 'network map' of devices with SMB shares you've to use the samba tools to get one. And similar tools for NFS shares or ....?
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 26, 2025, 10:03:07 pm
It is supposed to find all machines on the network, and here it does!

My hosts file on this newlt installed ArcaOS 5.0.7, read
127.0.0.1                localhost
and nothing else.
My router thus provide my machines with the information and ip-number through dhcp as the vacuum cleaner was introduced just days ago... and when the script run again it update the info (and icons, if SET NET=1 is active) and show that 2 devices has gone offline over the night.

So the question remain... why host command behave the way it does.

"DHCP Monitor" of course list the ip-address on LAN0 for you?
( Desktop\Computer\System Setup\Network\TCP/IP\DHCP Monitor )

DHCP Monitor shows my address as 192.168.0.106. My router doesn't show this. Possibly due the weird router/web thingy. I'm on a LTE connection and the router thing has a sim card and mostly uses WiFi for the local connections. MY OS/2 computer is plugged into the one lan port on the router thing.
I see the router doesn't list this computer on the device page. Later I should dig out my T42 and test with it as it does connect through wireless.
I can ping most of the machines on my net, perhaps the broadcast ping that Greg mentioned gets filtered.

Into your router as seen on the picture which I think has the DNS server.
Are you able to set a name to a connected @macaddr under setting ?
If yes, set to your ArcaOS @macaddr name to the one you set under config.sys (hostname)

Issue netstat -r and check the default router is your router as seen into the picture.
e.g. My internet box is at 192.168.1.254
   
netstat -r

destination             router                   netmask     metric  flags  intrf

default                192.168.1.254          0.0.0.0           0     UGP  lan0

May be you could use nsupdate to update your server !  not sure it will work, never tried...

Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 26, 2025, 10:34:27 pm
Into your router as seen on the picture which I think has the DNS server.
Are you able to set a name to a connected @macaddr under setting ?

No, it doesn't even show my machine, only the ones connected by WiFi. It does figure out the Roku stick

Quote
If yes, set to your ArcaOS @macaddr name to the one you set under config.sys (hostname)

Issue netstat -r and check the default router is your router as seen into the picture.
e.g. My internet box is at 192.168.1.254
   
netstat -r

destination             router                   netmask     metric  flags  intrf

default                192.168.1.254          0.0.0.0           0     UGP  lan0

May be you could use nsupdate to update your server !  not sure it will work, never tried...

Yes, the router is at 192.168.0.1, resolv2 shows 192.168.0.1 as the DNS server. It is a crappy router thingy and doesn't have much that can be changed in the settings. I'm stuck with it as the SIM card is tied to the router thingy as well as the local and only cell tower.
There's another layer of NAT too,
Code: [Select]

WAN IP Address
10.13.117.231

I could change the DNS server by editing resolv2 but I doubt it would make a difference.
Probably have to ping the whole sub-net to find everything connected.
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 26, 2025, 11:34:32 pm
Into your router as seen on the picture which I think has the DNS server.
Are you able to set a name to a connected @macaddr under setting ?

No, it doesn't even show my machine, only the ones connected by WiFi. It does figure out the Roku stick

Quote
If yes, set to your ArcaOS @macaddr name to the one you set under config.sys (hostname)

Issue netstat -r and check the default router is your router as seen into the picture.
e.g. My internet box is at 192.168.1.254
   
netstat -r

destination             router                   netmask     metric  flags  intrf

default                192.168.1.254          0.0.0.0           0     UGP  lan0

May be you could use nsupdate to update your server !  not sure it will work, never tried...

Yes, the router is at 192.168.0.1, resolv2 shows 192.168.0.1 as the DNS server. It is a crappy router thingy and doesn't have much that can be changed in the settings. I'm stuck with it as the SIM card is tied to the router thingy as well as the local and only cell tower.
There's another layer of NAT too,
Code: [Select]

WAN IP Address
10.13.117.231

I could change the DNS server by editing resolv2 but I doubt it would make a difference.
Probably have to ping the whole sub-net to find everything connected.

hum!

Into your ZTE MF275R, what do you have set under setting -> connection mode ?
I suppose automatic.
Do you have more available option under manual ?
- e.g. an option to set a specific @ip (and/or hostname) to a @macaddr or any other usefull option ?

Under my box, I added a setting to always use the same @ip (reserved from ip pool address) when my PC @macaddr is requesting a connection (dhcp) - the @ip set is returned to ArcaOS dhcp

Can you give a try and check result:
- tracerte 192.168.0.1
- tracerte 192.168.0.104
- tracerte 192.168.0.xxx (xxx, an other connected equipment)
- tracerte ARCAOS-44454C4

note: TRACERTE, PING can be ignored by some equipment for security issue or else.
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 27, 2025, 01:26:40 am
Seen.

I have a specific ARCAOS host_name under config.sys
Into my box and because my PC can be booted OS/2 or Windows using same interface, I have set a name to the corresponding @ip / macaddr
Using nslookup on my PC @ip I could see that my computer_name set into the box differs from the config.sys and after updating config.sys, it works

With WOL=0 and NET=0, it display all local equipments.
When I set WOL=1, I have all equipment but also many
(icoplte    (icoplte    (icoplte    (icoplte    (icoplte    (icoplte ....

With NET=1, I have the folder created as well all found equipment but none have an icon !
Where are icon found ?

I would suggest a change into the rexx which could prevent this kind of no returned result.
Check the interface used and look for its @ip followed by a nslookup on the @ip which will return the hostname and then run into the process like if the
the host_name was found into os2env variables....

Hi Jan-Erik,
The  (icoplte  is the result going through  X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' ) with host.i.macaddr set to "(incomplete)"
Than, T has the X (supposed @macaddr) copied 16 times.
finally:
        STG = S||T||G;
        SAY '>' STG '<'

Changing the X= to
        IF DATATYPE( STRIP( host.i.macaddr ), 'X' ) THEN X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' )
   Else X=host.i.macaddr

Will result into (incomplete) repeated 16 times
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 27, 2025, 02:06:13 am
Into your router as seen on the picture which I think has the DNS server.
Are you able to set a name to a connected @macaddr under setting ?

No, it doesn't even show my machine, only the ones connected by WiFi. It does figure out the Roku stick

Quote
If yes, set to your ArcaOS @macaddr name to the one you set under config.sys (hostname)

Issue netstat -r and check the default router is your router as seen into the picture.
e.g. My internet box is at 192.168.1.254
   
netstat -r

destination             router                   netmask     metric  flags  intrf

default                192.168.1.254          0.0.0.0           0     UGP  lan0

May be you could use nsupdate to update your server !  not sure it will work, never tried...

Yes, the router is at 192.168.0.1, resolv2 shows 192.168.0.1 as the DNS server. It is a crappy router thingy and doesn't have much that can be changed in the settings. I'm stuck with it as the SIM card is tied to the router thingy as well as the local and only cell tower.
There's another layer of NAT too,
Code: [Select]

WAN IP Address
10.13.117.231

I could change the DNS server by editing resolv2 but I doubt it would make a difference.
Probably have to ping the whole sub-net to find everything connected.

hum!

Into your ZTE MF275R, what do you have set under setting -> connection mode ?
I suppose automatic.
Do you have more available option under manual ?
- e.g. an option to set a specific @ip (and/or hostname) to a @macaddr or any other usefull option ?

Disconnected from the internet, changed to manual, let the router restart. No new settings. Just that I have to manually connect to the internet on the home page, so I switched back to automatic

Quote
Under my box, I added a setting to always use the same @ip (reserved from ip pool address) when my PC @macaddr is requesting a connection (dhcp) - the @ip set is returned to ArcaOS dhcp

Can you give a try and check result:
- tracerte 192.168.0.1
- tracerte 192.168.0.104
- tracerte 192.168.0.xxx (xxx, an other connected equipment)
- tracerte ARCAOS-44454C4

note: TRACERTE, PING can be ignored by some equipment for security issue or else.

I have no such settings, though what my son did was assign himself an IP address not in the DHCP pool after turning off DHCP on his box. You can see on the image I posted earlier how some devices don't have an address. I might do similar.
tracerte works for some addresses, including ARCAOS-44454C4 with one hop, or times out (* * *)
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 27, 2025, 02:20:48 am
Your dhcp config file under mptn\etc

should have:
# The following are requested for interoperability with some servers which
# need explicit requests.
 
option 1                                 # Subnet Mask
option 3                                 # Router
option 6                                 # Domain Name Server
option 12 "ARCAOS-44454C4"               # host name
option 15                                # Domain Name
option 28                                # Broadcast Address
option 33                                # Static Routes
option 60 "IBMWARP_V4.1"                 # Vendor Class
option 77 "IBMWARP_V4.1"                 # User Class
 
#updateDNSA "nsupdate -h%s -d%s -s"d;a;*;a;a;%s;s;%s;3110400;q" -q"

(I have lan as domain name but this can differ - do not use local)
Adding the domain name and enable the updateDNSA will generate a command to the server to update entries if recognized by it.
The used @ip will then have a hostname
   
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 27, 2025, 03:21:23 am
OK, did that, rebooted to be sure. Still nothing detected by macaddr.cmd unless I have my machine in the hosts file.
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 27, 2025, 06:13:36 am
SAY '>'STG'<'
is there to say it sent that as a Wake on Lan call to that machine.
But since the mac address isn't there it can't create a proper call to wake it up.
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 27, 2025, 08:20:15 pm
OK, did that, rebooted to be sure. Still nothing detected by macaddr.cmd unless I have my machine in the hosts file.

Hi Dave,

A last and final suggestion trying to use rexxsocket
Can you give a try adding following codes just under the STC = 

Code: [Select]
    DO
        X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' )
        SCT = SockSocket( 'AF_INET', 'SOCK_DGRAM', 'IPPROTO_UDP' );

        /* experimental */
TerminalAddr.!addr=host.i.ipaddr
Call SockGetHostByAddr TerminalAddr.!addr, "TerminalAddr.!"
If strip(TerminalAddr.!name)\='' then do
say "SockGetHost: "||TerminalAddr.!name||':' host.i.ipaddr||':' MAC;
host.i.name = TerminalAddr.!name
End 
/* end experimental */


If a name is returned, it should display SockGetHost: ....   
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 27, 2025, 09:17:15 pm
Feel free to modify the code and post it here, both for testing purposes and to improve it.
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 27, 2025, 11:08:51 pm
OK, did that, rebooted to be sure. Still nothing detected by macaddr.cmd unless I have my machine in the hosts file.

Hi Dave,

A last and final suggestion trying to use rexxsocket
Can you give a try adding following codes just under the STC = 

Code: [Select]
    DO
        X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' )
        SCT = SockSocket( 'AF_INET', 'SOCK_DGRAM', 'IPPROTO_UDP' );

        /* experimental */
TerminalAddr.!addr=host.i.ipaddr
Call SockGetHostByAddr TerminalAddr.!addr, "TerminalAddr.!"
If strip(TerminalAddr.!name)\='' then do
say "SockGetHost: "||TerminalAddr.!name||':' host.i.ipaddr||':' MAC;
host.i.name = TerminalAddr.!name
End 
/* end experimental */


If a name is returned, it should display SockGetHost: ....

No STC= here
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 28, 2025, 01:23:51 am
OK, did that, rebooted to be sure. Still nothing detected by macaddr.cmd unless I have my machine in the hosts file.

Hi Dave,

A last and final suggestion trying to use rexxsocket
Can you give a try adding following codes just under the STC = 

Code: [Select]
    DO
        X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' )
        SCT = SockSocket( 'AF_INET', 'SOCK_DGRAM', 'IPPROTO_UDP' );

        /* experimental */
TerminalAddr.!addr=host.i.ipaddr
Call SockGetHostByAddr TerminalAddr.!addr, "TerminalAddr.!"
If strip(TerminalAddr.!name)\='' then do
say "SockGetHost: "||TerminalAddr.!name||':' host.i.ipaddr||':' MAC;
host.i.name = TerminalAddr.!name
End 
/* end experimental */


If a name is returned, it should display SockGetHost: ....

No STC= here

Hi well seen ! I did a finger check ( SCT and not STC )

I just tried to modify some codes, I could test it under my system with good result but I always have a hosname and couldn't test my updates fully yet.
Here is my macaddr.cmd

PS:  Computer (from host) means that host command was used while Computer (from sockets) means that hostname wasn't return and was build using sockets information to complete system hostname with intrf info used as default local home domaine 

You can add icons from following os2world link
https://www.os2world.com/forum/index.php/topic,3867.msg47719.html#msg47719
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 28, 2025, 04:36:35 am
OK, using your version of the script returns,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  ARCAOS-44454C4.lan      192.168.0.106
ARCAOS-44454C4: 192.168.0.106: 70:20:84:0e:35:53
wake on lan sent:        7020840e35537020840e35537020840e35537020840e35537020840
e35537020840e35537020840e35537020840e35537020840e35537020840e35537020840e3553702
0840e35537020840e35537020840e35537020840e35537020840e3553     

With a 25 second delay between the Computer line and the rest. The line wrap was left. And your last idea shows in the .lan suffix.
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 28, 2025, 05:34:48 am
OK, using your version of the script returns,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  ARCAOS-44454C4.lan      192.168.0.106
ARCAOS-44454C4: 192.168.0.106: 70:20:84:0e:35:53
wake on lan sent:        7020840e35537020840e35537020840e35537020840e35537020840
e35537020840e35537020840e35537020840e35537020840e35537020840e35537020840e3553702
0840e35537020840e35537020840e35537020840e35537020840e3553     

With a 25 second delay between the Computer line and the rest. The line wrap was left. And your last idea shows in the .lan suffix.

No more need to add your hosname and @ip into hosts file which has @localip only
The lan is taken because you intrf is on a lan (this is a commun default domain used for home domain when on lan)
All my equipment have ".lan" set by my internet router DNS when on, lan interface 

The 25s may be normal with WOL set to 1 making it scans all @ip up to  .255
I tried a litle modification to set as "UNDEFINEDxxx" equipment not having a hostname (could not try)
My last modification is to add UNDEFINEDxxx (xxx is the last qualifier of the @ip) for registered equipment without hostname and add into WPS parms of this UNDEFINED hostname the corresponding found @ip following hostname
I changed some process to use @ip if hostname has UNDEFINED into its name

I comment the 2 initial SET line into de macaddr.cmd and use those from config.sys
uncomment bof lines if you would like set these two vars without config.sys update
e.g.  remove /* and */ of both lines and set value to 1 or 0
/* 'SET WOL=1' */   
/* 'SET NET=1' */

Curious to know if undefined equipment are found with this update ?
(restriction, changing an equipment without the hostname with an other equipment without hostname and using the same @ip may be indicated using same icon title)

Update: NO good, have to review (a litle better but undefined didn't work as expected)     
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 28, 2025, 09:16:52 am
Updated
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 28, 2025, 03:49:35 pm
Updated

This one runs much faster with,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  HOST: unknown host ARCAOS-44454C4
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 28, 2025, 08:26:49 pm
Updated

This one runs much faster with,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  HOST: unknown host ARCAOS-44454C4

Oops, developper error (had deleted a line into the code)

Now, updated
I change UNDEFINEDxxx host name to use UHOST-xxx  with xxx the last @ip qualifier  (my router adds HOST-nnn with nnn an incremental number set to a connected @mac)

Hope it been better.
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on March 28, 2025, 08:52:27 pm
Great update of the script Remy!  8)

It now tell me that the vacuum cleaner has gone offline for the night, but it managed to pull out the cable of the laptop today and ensured it went offline as well.

I comment the 2 initial SET line into de macaddr.cmd and use those from config.sys
uncomment bof lines if you would like set these two vars without config.sys update
e.g.  remove /* and */ of both lines and set value to 1 or 0
/* 'SET WOL=1' */   
/* 'SET NET=1' */

Just type
SET WOL=1
SET NET=1
on the command line before you run the script and those will be added to each object it create, thus not require any of them in config.sys

or create a program object "Refresh" pointing to the script, without any parameter, but with
WOL=1
NET=1
in the Environment tab (See each created network object for examples).


How about merging/reuse code for the various calls that resemble each other, and control them with parameters?
Perhaps explore the use of parsing templates:
PARSE VALUE ... WITH pre (fixed_variable1) mid (fixed_variable2) post

The idea was initially to build a network map of the devices found on the home LAN with info about them.
What uses can we explore here?
Shares would be one thing, but ... are there something else that one want and can be created?!
Title: Re: [Classic REXX] Network Map
Post by: Dave Yeo on March 28, 2025, 11:51:00 pm
Updated

This one runs much faster with,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  HOST: unknown host ARCAOS-44454C4

Oops, developper error (had deleted a line into the code)

Now, updated
I change UNDEFINEDxxx host name to use UHOST-xxx  with xxx the last @ip qualifier  (my router adds HOST-nnn with nnn an incremental number set to a connected @mac)

Hope it been better.

This one took about 50 seconds to finish,
Code: [Select]
Scan started using env parameters: WOL(1) and NET(1)
Computer (from sockets):  HOST: unknown host ARCAOS-44454C4.lan    192.168.0.106

Uhost-106.lan: 192.168.0.106: 70:20:84:0e:35:53
wake on lan sent:        7020840e35537020840e35537020840e35537020840e ...
> WPS Refreshed for: Uhost-106.lan 192.168.0.106

Title: Re: [Classic REXX] Network Map
Post by: Remy on March 29, 2025, 09:58:14 am
Hi !

Several changes
- When PC is booted and no activity was done on the network, ARP table has too less information in it (use of an initial ping resolves this)     
- reduced as possible the full scan time ( should be dropped to something nearly 12s )
- had to introduce several changes due I found that some registered @mac format could make some scan buggy (e.g. x :xx:x :xx:xx:x while xx:xx:xx:xx:xx:xx is expected)
- Add env var FLC for ARP flush (when this env is set to 1, a WPS object is created to allow full scan refresh following an arp flush

Regards
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 29, 2025, 10:12:08 am
Great update of the script Remy!  8)

It now tell me that the vacuum cleaner has gone offline for the night, but it managed to pull out the cable of the laptop today and ensured it went offline as well.

I comment the 2 initial SET line into de macaddr.cmd and use those from config.sys
uncomment bof lines if you would like set these two vars without config.sys update
e.g.  remove /* and */ of both lines and set value to 1 or 0
/* 'SET WOL=1' */   
/* 'SET NET=1' */

Just type
SET WOL=1
SET NET=1
on the command line before you run the script and those will be added to each object it create, thus not require any of them in config.sys

or create a program object "Refresh" pointing to the script, without any parameter, but with
WOL=1
NET=1
in the Environment tab (See each created network object for examples).


How about merging/reuse code for the various calls that resemble each other, and control them with parameters?
Perhaps explore the use of parsing templates:
PARSE VALUE ... WITH pre (fixed_variable1) mid (fixed_variable2) post

The idea was initially to build a network map of the devices found on the home LAN with info about them.
What uses can we explore here?
Shares would be one thing, but ... are there something else that one want and can be created?!

Interesting project and seems to be enough like it is.
I found a good use :D
I have an audio streamer connected but not using it for a long time, it is no more usable through my control TAB and had to reboot the streamer
Now, I saw its status change and just refreshing it make the streamer wakeup...
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 31, 2025, 07:32:58 pm
Corrected some code and added gateway, uc identifier
Added a refresh icon without arp flash.
(to have both refesh pgm icons created, change for only one run:
/* 'SET WOL=1' */  to  'SET WOL=1'
/* 'SET NET=1' */  to  'SET NET=1'
/* 'SET FLC=1' */  to  'SET FLC=1'

At end of run, set this line as it was originally.

Restriction: display network devices @mac under one sub-node only

For icons: https://www.os2world.com/forum/index.php/topic,3867.msg47719.html#msg47719

     
Title: Re: [Classic REXX] Network Map
Post by: Remy on March 31, 2025, 08:56:16 pm
I just had an idea !

Now, at first time run with FLC=1, a macaddr.cfg is created with a list of your home network devices in the form of  " @mac @ip hostname "
For UHost-xxx or names not well describing the device, you can change the hostname from into this cfg file
During the process, I only check for the corresponding @mac and not @ip and only those @mac having hostname changed, the change is taken and the icon will
display the user setted hostname but into the parameters, initial hostname is always left intact to allow correct process.

:D     
 
note, in my case, I replaced a host-002 sent by my Router/DNS to my Streamer real name.
Title: Re: [Classic REXX] Network Map
Post by: Remy on April 01, 2025, 01:20:57 am
Hi Jan-Erik
Sorry having added a lof of codes  ::)
Title: Re: [Classic REXX] Network Map
Post by: Jan-Erik Lärka on April 01, 2025, 09:18:32 pm
Hi Jan-Erik
Sorry having added a lof of codes  ::)

Ohh, yes, I soooOOooo crossed (NOT!) that you've improved the script further than one could hope for.

I''m actually very pleased that you've come up with all of these enhancements, but don't tell anyone I wrote that.  ;)
Title: Re: [Classic REXX] Network Map
Post by: Remy on April 03, 2025, 12:35:02 am
Update:  Added interface number on Domain folder. Updated missing domain procedure to identify any @ip missing domain name and not only UC/GW
(e.g. in case of multiple up interfaces - 2 lan or lan + wan with registered entries into arp table)

Network devices are listed under the corresponding Domain [interface number] folder 

note: not having multiple interfaces, I added needed code (which should work) but couldn't test this specific part results   

Title: Re: [Classic REXX] Network Map
Post by: Remy on April 10, 2025, 01:03:17 am
Updated.
note: If a host is unplugged and no more referenced into arp, it status goes removed.
          Using refresh (not ARP -F) once this host is plugged in again, using same @ip as before, the corresponding icon status changes again

note: Using previous macaddr without interface number, a first ARP-F should be run or erase existing *.cfg if available.

File removed...
Title: Re: [Classic REXX] Network Map
Post by: Remy on April 10, 2025, 02:35:29 pm
I apology, I left a typo into my latest posted macaddr.cmd (zip) file resulting into corrupted cfg file when using flush

macaddr corrected using my latest modification which includes a retention delay for any removed host. Once the delay is passed, the WPS object of the removed host is deleted but the cfg file already has its entry to allow adding it again as it was (if same ip) when inserted again.
cfg file has a date value out of date(B) value on first position

Note: to check how it works, run one time the refresh with your existing cfg file. This one will be updated with current date each time you run the refresh
reduce the day valu by more than 7 days on offline (removed) host and run refresh again to see how it works. Then, you can set date value again to the latest value and run refresh again.     
 
( by default, I set the retention delay to 7 days and you can change it to any value [ see the corresponding entry into macaddr.cmd ] )