GNU/Linux Command – IP (Part-2)

ip — Manipulate network device, routing and tunnels

Summary:
The ip is a swiss army knife command. It does many functions like assigning IP addresses to interfaces, for setting up routes and display configurations etc. In this part, we will see some of the protocol (IP) address management using the IP command.

Examples:
$ ip address -- Show the address of the interfaces. $ ip address show -- Same as above. $ ip address show eth0 -- Show only eth0 interface. $ ip addr show scope global -- Show all global addresses. $ ip addr show scope host -- Show all host addresses. $ ip addr show to 192.168.0.0/16 -- Show all prefix matching IP. $ ip addr show primary -- Show primary address. $ ip addr show secondary -- Show secondary address. $ ip addr show label "eth*" -- Show the matching interfaces. # ip addr add 127.0.0.1/8 brd + dev lo scope host -- Add IP tolo interface. # ip addr add 10.1.1.1/24 brd + dev eth0 scope global -- Add IP toeth0 interface. # ip addr add 10.1.2.1/24 brd + dev eth0 -- Add 2nd IP to eth0 # ip addr add 10.1.3.1/24 brd + dev eth0 label eth0:1 -- Add IP to eth0 with a label (alias). # ip addr del dev eth0 -- Delete the 1st IP address. # ip addr del dev eth0 10.1.3.1/24 -- Delete the specific IP. # ip addr flush to 10.0.0.0/8 -- Delete all local IPs. # ip addr -4 flush label "eth*" -- Delete all IPv4 addressof Ethernet interfaces.
Read: man ip

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: