Privacy Policy
© 2025 linux101.dev

ip Command

The ip command is a modern and powerful tool for network configuration on Linux. It replaces older, classic tools like ifconfig, route, and arp.

Managing IP Addresses

Show All Interfaces

ip addr show

Displays information about all network interfaces on the system. Can be shortened to ip a.

Show Specific Interface

ip addr show eth0

Shows information only for a specific interface (e.g., eth0).

Assign Static IP

ip addr add 192.168.1.100/24 dev eth0

Assigns a static IP address and a subnet mask to an interface.

Remove IP

ip addr del 192.168.1.100/24 dev eth0

Removes an IP address from an interface.

Managing Routing Table

Show Routing Table

ip route show

Displays the kernel routing table. Can be shortened to ip r.

Set Default Gateway

ip route add default via 192.168.1.1

Sets the default gateway for all traffic, which is the router traffic is sent to by default.

Checking Your Public IP Address

Your local IP address is different from your public (external) IP address, which is visible on the internet. You can find your public IP by querying an external web service.

Get Public IPv4

curl ifconfig.me

Retrieves and displays your public IPv4 address from the ifconfig.me service.

Get Public IPv6

curl -6 ifconfig.me

Forces curl to use IPv6 to retrieve and display your public IPv6 address (if available).