Skip to content

HomeSetup Developer Handbook

Applications handbook

Table of contents

Check-IP

usage: check-ip.bash <ip_address> [options]
    Validate an IPv4 address and display class, scope, and optional details.

    options:
      -q | --quiet            : Validate only; skip scope/class details.
      -i | --info             : Fetch additional information from the web.
      -h | --help             : Display this help message.
      -v | --version          : Display current program version.

Purpose

Validate and check information about a provided IP address.

Returns

0 if the IP is valid; non-zero otherwise.

Parameters

  • $1 Required : The IP address.

Examples:

check-ip.bash 192.168.0.10

Output

Valid IP: 192.168.0.10, Class: C, Scope: Private

check-ip.bash -i 192.158.100.10

Output

Valid IP: 192.158.100.10, Class: C, Scope: Public
{
    "status": "success",
    "country": "United States",
    "countryCode": "US",
    "region": "OR",
    "regionName": "Oregon",
    "city": "Beaverton",
    "zip": "97077",
    "lat": 45.4991,
    "lon": -122.823,
    "timezone": "America/Los_Angeles",
    "isp": "Tektronix",
    "org": "Tektronix, Inc",
    "as": "",
    "query": "192.158.100.10"
}