AIX — VLAN IP Discovery Runbook

DISCOVERY VLAN 131 · /24
Platform
AIX
Shell
ksh
Subnet
192.168.131.0/24
Method
ICMP sweep + ARP
Scope
Local L2 only
Privilege
root not required
Phase 1 Parallel Ping Sweep
01 Seed the ARP cache with a parallel ICMP sweep SWEEP
# Parallel ping sweep across 192.168.131.1 - 192.168.131.254 i=1 while [ $i -le 254 ]; do (ping -c 1 -w 1 192.168.131.${i} >/dev/null 2>&1) & i=$((i+1)) done wait sleep 2
Command Breakdown
i=1Initialise loop counter at the first usable host octet.
while [ $i -le 254 ]Iterate until the broadcast address is reached. 254 stops short of .255 (the broadcast for a /24).
( ping ... ) &Subshell launched in the background — the loop does not wait for ping to finish before launching the next one. This parallelises the sweep.
ping -c 1 -w 1AIX ping syntax — send 1 packet, wait 1 second for a reply. -w on AIX is timeout in seconds (not deadline like on Linux).
>/dev/null 2>&1Discard both stdout and stderr — we don't care about ping output, only the ARP side-effect.
i=$((i+1))POSIX arithmetic increment — pure ksh, no external expr needed.
waitBlock until every backgrounded subshell finishes. Without this, the next command would race ahead of unfinished pings.
sleep 2Allow the ARP cache to settle. Background pings can complete a few ms before their ARP entry is fully populated.

Why parallel: a serial sweep with a 1s timeout would take 4+ minutes for a /24. Backgrounding all 254 pings at once finishes in ~5 seconds and produces 254 job-control lines like [1] 14352834 as PIDs are registered, then Done / Done(1) as each completes. Done(1) = ping got no reply, Done = reply received — but you don't need to read these; the ARP table is what matters.

Phase 2 Resolve & Format Results
02 Read ARP cache, reverse-resolve hostnames, append MAC RESOLVE
arp -an | awk '/\(.*\)/ && !/incomplete/ {ip=$2; gsub(/[()]/,"",ip); print ip, $4}' | \ sort -t. +3n -4 | \ while read ip mac; do name=$(host $ip 2>/dev/null | awk '/domain name pointer|name =/ {print $NF}' | sed 's/\.$//') [ -z "$name" ] && name="<no PTR>" printf "%-18s %-32s %s\n" "$ip" "$name" "$mac" done
Command Breakdown — Pipeline Stage 1: Extract from ARP
arp -an-a dumps the full ARP cache; -n suppresses reverse DNS at this stage (faster — we resolve manually later for control over output format).
awk '/\(.*\)/ && !/incomplete/'Match only lines containing a parenthesised IP and exclude any incomplete entries (unanswered ARP probes that left a stub in the cache).
{ip=$2; gsub(/[()]/,"",ip); print ip, $4}Field 2 is (IP) — strip the parentheses with gsub, then print the cleaned IP and field 4 (the MAC). Outputs ip mac per line for the next stage.
Command Breakdown — Pipeline Stage 2: Sort Numerically
sort -t.Use . as the field separator — splits each IP into 4 fields by octet.
+3n -4AIX-native sort syntax. Sort starting at field offset +3 (the 4th octet) up to but not including field -4, numerically (n). AIX sort does NOT accept GNU -k4 -n style.
Command Breakdown — Pipeline Stage 3: Resolve & Print
while read ip mac; doRead each sorted line into two variables — ip and mac — split on whitespace.
name=$(host $ip ...)Run a reverse DNS lookup. Output of host on AIX is typically X.Y.Z.W.in-addr.arpa domain name pointer host.fqdn.
awk '/domain name pointer|name =/ {print $NF}'Match either AIX-style (domain name pointer) or BIND-style (name =) output and extract the last field — the FQDN.
sed 's/\.$//'Strip the trailing dot DNS appends to FQDNs.
[ -z "$name" ] && name="<no PTR>"If no PTR record exists, the lookup returns nothing — substitute a placeholder so the column stays aligned.
printf "%-18s %-32s %s\n"Print three left-justified columns: IP (18 chars), hostname (32 chars), MAC. Produces a clean, aligned table.

AIX gotchas: the GNU sort -t. -k4 -n form will fail with a usage error on AIX — always use the +pos -pos notation. Likewise, host may not be in stock AIX; if absent, swap it for nslookup $ip 2>/dev/null | awk '/name =/ {print $NF}' | sed 's/\.$//'.

Phase 3 Expected Output
03 Reference output — VLAN 131 sweep result SAMPLE
192.168.131.1 <no PTR> 0:59:dc:77:71:ec 192.168.131.13 <no PTR> fa:16:3e:6f:c9:a7 192.168.131.20 <no PTR> fa:16:3e:52:25:a5 192.168.131.50 <no PTR> e6:8:0:3c:91:83 192.168.131.54 <no PTR> 0:11:25:bf:a8:96 192.168.131.66 <no PTR> 32:8a:67:b3:4e:6 192.168.131.68 <no PTR> 0:e:11:14:3d:80 192.168.131.101 <no PTR> 8:94:ef:22:a2:ca 192.168.131.150 <no PTR> 8:94:ef:22:a2:ca 192.168.131.201 <no PTR> 84:a9:38:d2:88:4d 192.168.131.202 <no PTR> e0:91:f5:9c:f2:c7 192.168.131.204 <no PTR> e0:91:f5:9c:f9:47 192.168.131.205 <no PTR> 7c:d3:a:5b:b2:8b 192.168.131.210 <no PTR> 7c:d3:a:de:35:1 192.168.131.223 <no PTR> 0:50:56:b8:7c:c8 192.168.131.228 <no PTR> b8:ca:3a:75:84:e4 192.168.131.233 <no PTR> 8:94:ef:c:99:c0 192.168.131.237 <no PTR> 8:94:ef:c:99:c1 192.168.131.249 <no PTR> 0:e:11:15:68:37 192.168.131.254 <no PTR> 0:1c:7f:8b:dc:a5

Reading the MAC OUI prefixes: when DNS is missing, the first three octets of the MAC (OUI) often identify the device vendor — useful for triage:
fa:16:3e → OpenStack / KVM virtual NIC
00:50:56 → VMware vSwitch
b8:ca:3a → Dell
00:0e:11 → Dell (older / iDRAC range)
84:a9:38 → IBM
e0:91:f5 → Dell EMC
7c:d3:0a → IEEE-allocated, varies
Note duplicate MACs at .101/.150 and the consecutive .233/.237 pair — likely the same device with two interfaces, or a VRRP/HSRP virtual address. Worth confirming with the network team before claiming either as "free".

⚠ Key Notes