ip

Inspect and change addresses, routes and links

About

ip inspects and configures the network stack: addresses, routes, interfaces and the neighbour cache. Use it to find your own address or see where traffic is being sent. It replaces the older net-tools commands.

Install it

pkg install iproute2

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

ip addr show Show every interface with its addresses. The quickest way to find your Wi-Fi address.
ip route show Print the routing table. You see the gateway your traffic uses.
ip link show List the interfaces with their state, hardware addresses and MTU values.
ip neigh show Display the neighbour cache, mapping local addresses to hardware addresses.
ip addr add 192.168.1.50/24 dev wlan0 Assign a static address to an interface for a fixed test setup.
ip route add default via 192.168.1.1 Set the default gateway by hand for a connection with no route out.

Worked example

Run ip addr show wlan0 and this is what you should see.

termux
$ ip addr show wlan0
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP>
    link/ether 02:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.42/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever

Developed by

Stephen Hemminger and the iproute2 maintainers .