Skip to main content

Recently while troubleshooting a connection problem this question arose. The OpenVOS system was connecting to a public Internet facing server. The administrator for the server asked a simple question “What is your IP address?” The OpenVOS system has an IP address from one of the private internet ranges defined by RFC 1918, call it This private address is translated by a NAT device into a public address as it leaves the private internet and goes onto the Internet. The administrator needed to know the public address. The OpenVOS system administrator had no idea and there was a scramble to find  a network administrator who could tell us.

There are any number of Internet web sites that you can connect to that will tell you what your IP address is BUT they all use HTTP and OpenVOS does not have a web browser that can be used to connect to those sites.

To make sure that I am not placed in the same situation again I wrote the following command macro using stcp_calls. It can be used to make a connection to a web site and display the text of the site’s root web page. The display is a hex-ascii dump of the returned data, it is not pretty but it is readable. There are some other limitations as well. First, not all sites will work. Many sites require that the browser follow a link on the root page to actually get the IP address, something the browser does automagically but my script will not do. Still I found a few sites that work with the script, check the comments in the script. I suggest that you run the macro in a started process.

The second limitation is due to how the NAT device translates the IP addresses. Some devices will change all outgoing traffic so that it has the same source address, other devices will have a set of IP addresses that they use for the source IP address, selecting a specific address based on an internal algorithm. All I can suggest is to run the macro multiple times and see what you get. All the addresses should be on the same subnetwork but I cannot predict what that subnetwork will be.

& find_my_ip_address begins here
& Version 1.00 10-12-06
& Version 1.01 10-12-08 added another site to the list
& [email protected]
& This script connects to a web site and retrieves the root page. Many sites
& that display your IP address require that the browser follow a link on the
& root page to display your IP address. These sites will not work with this
& script. I have tested the following sites and they currently work (although
& I make no promises for the future).
& The output is displayed in a hex-dump/ascii format. Not easy to read but
& you should be able to spot the IP address. I suggest that you run the
& script as a started process and then search the output.
&       SERVER               NOTES
&       ------               -----
&           search for "is:"
&  last set of non-null bytes in the last buffer
&      search for "is:" and yes, it is one d in adress
&     last set of non-null bytes in the last buffer
& This software is provided on an "AS IS" basis, WITHOUT ANY WARRANTY OR ANY
& applies, despite any verbal representations of any kind provided by the
& author or anyone else.
SERVER server:string,req
&if (process_type) = 'batch' &then &do
&echo no_input_lines no_command_lines no_macro_lines
0 47 45 54 20 2F 20 48 54 54 50 2F 31 2E 30 0a 0a

connect -name &SERVER& -port 80
send -len 16
&label AGAIN
..start_logging (process_dir)>recv
recv -len 1000
&set_string LINE (contents (process_dir)>recv 1)
..display_line &LINE&
&if (index (contents (process_dir)>recv 1) ' 0 bytes') > 0 &then &goto QUIT
&if (index (contents (process_dir)>recv 1) 'bytes') = 0 &then &goto QUIT
&goto AGAIN
&label QUIT
& find_my_ip_address ends here


© 2020 Stratus Technologies.