The ip command
The ip command shows and changes network settings…
The ip command shows and changes network settings: ip a lists the network interfaces and their IP addresses, and ip route shows the way to other networks.
Taught in Advanced, lesson 45
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.
Usage
ip addr ip -br addr ip route ip link
Show network addresses and routes. Shows this machine’s network interfaces and addresses (ip addr, or ip a), and its routes (ip route): where packets go, and the default gateway they leave through. Here your laptop is 10.0.0.5 on the 10.0.0.0/24 network, and the router 10.0.0.1 is the gateway. In this practice shell the network is a simulation inside your browser: the machines web, db and router and the website example.com are pretend, and nothing leaves your device.
In the practice terminal:The addresses are the pretend network’s: your laptop is 10.0.0.5, the router 10.0.0.1, web 10.0.0.10 and db 10.0.0.20. It doesn’t show your real network.
How to use ip
Find your IP address: ip a
lo is the loopback, the machine talking to itself (127.0.0.1). The inet line under the next interface is your address on the network; /24 says how big the network is.
ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:12:34:05 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.5/24 brd 10.0.0.255 scope global dynamic eth0
valid_lft forever preferred_lft forever
A short list: ip -br addr
ip -br addrlo UNKNOWN 127.0.0.1/8 eth0 UP 10.0.0.5/24
The default gateway: ip route
The default via line is the router that everything outside your own network goes through.
ip routedefault via 10.0.0.1 dev eth0 proto dhcp src 10.0.0.5 metric 100 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.5 metric 100
Another machine’s address
ssh webThe authenticity of host 'web (10.0.0.10)' can't be established. ED25519 key fingerprint is SHA256:aaVFThjlH4/WIvuW5JbeDsUSex1ZSOHtUS3pZXDPB10. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'web' (ED25519) to the list of known hosts. learner@web's password: Welcome to Ubuntu 24.04 LTS (practice web server web) This is a pretend machine inside your browser. Type exit to go back to sandbox. Last login: Mon Jan 12 06:39:27 2026 from 10.0.0.5
ip -br addrlo UNKNOWN 127.0.0.1/8 eth0 UP 10.0.0.10/24
Options
| addr, a | addresses |
|---|---|
| route, r | routes |
| link, l | interfaces |
| -br | brief, one line each |
Questions about ip
What is the difference between ip and ifconfig?
ifconfig is the old tool from net-tools, which many systems no longer install. ip replaced it: ip a instead of ifconfig, and ip route instead of route -n.
How do I find my public IP address?
ip a shows your address on your own network. The address the internet sees belongs to your router; a service such as ifconfig.me reports it (curl ifconfig.me) on a real machine.
What does /24 after an address mean?
How many bits name the network. In 10.0.0.5/24 the first three numbers (10.0.0) are the network and the last one the machine, so the network has 256 addresses.
Learn it step by step
Related commands
Every everyday command on one page, to print or keep open: the Linux commands cheat sheet.