Skip to content

chaosnet-io/netface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

netface

netface is a simple Bash command‑line utility that provides a quick, at‑a‑glance summary of your network interfaces and external IP information. It displays each interface’s state, MAC address, IPv4/IPv6 addresses, default gateway, and DNS servers, plus your current public IP and the system’s primary DNS resolver.

Features

  • Lists all non-loopback network interfaces
  • Shows interface STATE, MAC, IPv4, IPv6, GATEWAY, and DNS
  • Fetches and displays your External IP
  • Footers the external IP with the system’s primary DNS resolver
  • Falls back gracefully if certain tools or data are unavailable

Requirements

  • bash (v4+)
  • iproute2 (ip command)
  • One of:
    • curl (to fetch external IP from ifconfig.me)
    • dig (to fetch external IP via OpenDNS)
  • resolvectl (optional, for per‑interface DNS; falls back to /etc/resolv.conf)

Installation

  1. Save the script as netface in a directory on your PATH, e.g. ~/bin/netface:
  2. Make it executable:
    chmod +x ~/bin/netface
  3. Ensure ~/bin (or wherever you saved it) is in your PATH:
    export PATH="$HOME/bin:$PATH"

Usage

netface

Sample Output

INTERFACE  STATE    MAC               IPv4                 IPv6                 GATEWAY         DNS                 
---------- -------- ----------------- -------------------- -------------------- --------------- --------------------
eth0       up       1a:2b:3c:4d:5e:6f 192.168.1.23/24      fe80::1234/64         192.168.1.1    192.168.1.1      
wlan0      down     0a:1b:2c:3d:4e:5f –                    –                     –               –                   
enp3s0     up       aa:bb:cc:dd:ee:ff 10.0.0.15/16         2001:db8::abcd/64     10.0.0.1       10.0.0.2        
docker0    up       02:42:ac:11:00:02 172.17.0.1/16        –                     –               –                   
tun0       up       00:00:00:00:00:00 10.8.0.2/24           –                     10.8.0.1       10.8.0.1      

External IP: 203.0.113.47 (DNS: 8.8.8.8)

Column Breakdown

  • INTERFACE: Name of the network interface (e.g. eth0, wlan0).
  • STATE: Operational state (up, down, etc.).
  • MAC: Hardware (MAC) address.
  • IPv4: Assigned IPv4 CIDRs.
  • IPv6: Assigned global-scope IPv6 CIDRs.
  • GATEWAY: Default IPv4 gateway for the interface.
  • DNS: Primary DNS server(s) for the interface (or system fallback).

In the footer:

  • External IP: Your public IP as seen by external services.
  • DNS: The system’s primary DNS resolver, used for external lookups.

Customization

This was sort of tailored to my needs, but if you need more data, here's a quick-start-quide:

  • To adjust column widths, edit the printf format strings at the top of the script.
  • To include RX/TX counters, link speeds, or other metrics, add additional ip, ethtool, or /sys/class/net queries in the loop.

Troubleshooting

  • If MAC or gateway fields appear empty, confirm you have permissions to read /sys/class/net and that iproute2 is installed.
  • If External IP fails, install curl or dnsutils (for dig).
  • If DNS is incorrect, ensure resolvectl is available or /etc/resolv.conf is properly populated.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages