router - determine external router detailsSYNOPSIS
Command router prints the Internet IP address of an external router.
Command routerx uses the IPHLPAPI to determine the IP address and interface index of up to two external routers. Results are written to the NAT32 variables router1, ix1 and router2, ix2. The results are written in the order found and the command iphlp can be used to obtain more information.
Command router1 ip interrogates the Windows TCP/IP configuration of the interface with the specified IP address and determines its gateway address and interface index. If a gateway is found, the NAT32 variables router1 and ix1 are updated.
Similarly, command router2 ip interrogates the Windows TCP/IP configuration of the interface with the specified IP address and determines its gateway address and interface index. If a gateway is found, the NAT32 variables router2 and ix2 are updated.
The router command works by fetching http://www.nat32.com/php/myip.php via the current Windows default gateway and then printing the returned data. Note that if a VPN connection to an external VPN Server is currently in place, and if Windows is currently using that connection as its default route, then the value printed will be the IP address of the local end of the VPN connection.
To copy the value to a NAT32 environment variable (e.g. router), the command router | set router can be used.
The other commands work by calling IPHLPAPI functions. Note that while NAT32 does set the router-related variables on startup, more details should be obtained via the iphlp command before using those initial settings.