GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IPADDR(1) User Commands IPADDR(1)

ipaddr - command-line IP address manipulation tool

ipaddr [-M] ADDRESS [COMMAND [ARGS...]] ...

ipaddr is a command-line tool for manipulating and querying IP addresses and networks. It provides functionality similar to Python's ipaddress module but as a standalone CLI utility.

Commands can be chained; chainable commands update the current address for use by subsequent commands.

Output prefix as netmask (e.g., /255.255.255.0 instead of /24).
Display help message and exit.

(none)
Print normalized address.
Print IP version (4 or 6).
Print address as hexadecimal bytes (no separators).
Print address as decimal integer.

Print prefix length.
Print network mask.
Print host mask (inverse of netmask).
Print address without prefix.

Print network address with prefix.
Print broadcast address. Requires address with prefix.
Print number of addresses in network.
Print host at index (negative indices count from end).
Print index of address within its network.
Print subnet. PLEN is prefix length (or +N for relative). INDEX may be negative to count from end.
Print supernet. PLEN is prefix length (or -N for relative).

Each returns exit code 0 if true, 1 if false.

Check if address is loopback.
Check if address is private (RFC 1918 for IPv4, ULA for IPv6).
Check if address is global unicast.
Check if address is multicast.
Check if address is link-local.
Check if address is unspecified (0.0.0.0 or ::).
Check if address is reserved.

Print IPv6 zone ID (interface name or number).
Print IPv6 numeric scope ID.
Extract IPv4 address from IPv6 (mapped, compatible) or pass through.
6to4
Extract IPv4 address from 6to4 address.
Extract Teredo server or client IPv4 address.

Each takes an ADDRESS argument and returns exit code 0 if true, 1 if false.

Check if current network is contained in ADDR.
Check if current network contains ADDR.
Check if current network overlaps with ADDR.
Check if equal to ADDR.
Check if not equal to ADDR.
Check if less than ADDR.
Check if less than or equal to ADDR.
Check if greater than ADDR.
Check if greater than or equal to ADDR.

0
Success, or boolean true for is-* and comparison commands.
1
Boolean false for is-* and comparison commands.
2
Usage error or invalid input.

Normalize an IP address:

$ ipaddr 192.168.001.001
192.168.1.1

Get network address:

$ ipaddr 192.168.1.30/28 network
192.168.1.16/28

Chain commands to find a specific host in a subnet:

$ ipaddr 192.168.0.0/16 subnet 24 5 host 100
192.168.5.100

Check if an address is private:

$ ipaddr 10.0.0.1 is-private && echo "Private" || echo "Not private"
Private

Convert to decimal integer:

$ ipaddr 192.168.1.1 to-int
3232235777

Output with netmask notation:

$ ipaddr -M 192.168.1.0/24
192.168.1.0/255.255.255.0

ipcalc(1), sipcalc(1)

Eugene Kim

Copyright © 2025 Eugene Kim. License: MIT.

January 2025 ipaddr 1.0.0

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.