How to use SSH ip command

If you want to obtain information about your server’s IP on a Linux machine over SSH, the SSH ip command is the tool you need. It is handy, beginner-friendly, and powerful, because your IP is one of the most important assets of any server. In this article, we will show you the basic usage of the SSH ip command with clear examples.

What is the SSH ip command?

In short, ip is the modern Linux utility for viewing and managing network interfaces, addresses, and routes. To get started, connect to your account over SSH, then run the examples below to inspect or change your server’s IP configuration.

Display all network interfaces and their IP addresses

First, list every interface and its assigned IP address with a single command:

ip a

Switch between IPv4 and IPv6

Next, you can narrow the output to a single protocol. Use the -4 or -6 flag to show only IPv4 or IPv6 addresses:

ip -4 a
ip -6 a

Assign an IP address to an interface

Additionally, the ip command lets you add an address to a network interface. Replace IP and INTERFACE with your own values:

ip a add IP dev INTERFACE
ip a add 192.0.2.10/24 dev eth0

Delete an IP address from an interface

Finally, you can remove an address just as easily. Simply swap add for del:

ip a del IP dev INTERFACE
ip a del 192.0.2.10/24 dev eth0

Because these changes apply immediately, always double-check the interface name and address before you press Enter.

Need more help?

Master the basic Linux commands with examples on a SSH shared hosting account, or get full root control with a JetHost VPS. Both include free SSH access and full Linux terminal support, so you can run the SSH ip command directly on your server today.