The IP of the Linux command

Source: Internet
Author: User

IP [OPTIONS] OBJECT {COMMAND | help}

This command contains almost all the methods of use, where

Object object={link | addr | addrlabel | route | rule | neigh | ntable | tunnel | maddr | mroute | mrule | monitor | xfrm | to Ken}

Option options={-v[ersion] |-s[tatistics] |-d[etails] |-r[esolve] |-h[uman-readable] |-iec |-f[amily] {inet | inet6 | i px | dnet | LINK} | -o[neline] | -t[imestamp] | -b[atch] [filename] | -RC[VBUF] [size]}

However, command is long, please use ' IP OBJECT help ' to view.

The rest is shown below:

IP [-force]-batch filename

IP is a powerful network configuration tool within the IPROUTE2 package for displaying or manipulating routing, network devices, Policy routing, and tunneling, which can replace traditional network management tools such as Ifconfig, route, and so on.

(1). Object

Link Network device Address device protocol (IP or IPV6) addresses Addrlabel protocol address selected label configuration neighbour ARP or Ndisc cache entry route table entry rule in the Rules routing policy database maddress Multicast address Mroute Multicast routing cache entry tunnel IP tunnel xfrm IPSec protocol framework

The names of all objects can be written in full or abbreviated form, for example, address can be abbreviated as addr or just a.

(2). Options

-v,-version Display instruction version information-s,-stats,statistics output details-h,-human,-human-readable output human-readable statistics and suffixes-iec print human-readable rates in IEC standard units (e.g. 1k= 1024x768)-f,-family <FAMILY> Specifies the protocol family to use. The protocol family identifier can be one of inet, Inet6, IPX, dnet, or link. If this option is not present, the protocol family is inferred from the other parameters. If the remainder of the command line does not provide enough information to speculate on the family, the IP is returned to the default value, usually inet or any. Link is a special series identifier that indicates that the network protocol is not involved. -4–family inet Shortcut -6–family inet6 shortcut -0–family link shortcut-o,-oneline export each record to one line, replacing line breaks with ' \ ' characters. -r,-resolve uses the system name resolver to print the DNS name instead of the host address.

(3). Example

View all IP addresses

IP a/addr/address

IP a/addr/address sh/show

View the specified IP address

IP a/addr/address sh/show Dev eth1

IP a/addr/address sh/show eth1

[[Email protected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN     link/loopback 00 : 00:00:00:00:00 BRD 00:00:00:00:00:00    inet 127.0.0.1/8 Scope host lo    INET6:: 1/128 scope host        Valid_lft Forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up Qlen 1000    link/ether 00:0c:29:42:9f:ce brd ff:ff:ff:ff:ff:ff    inet 192.168.78.129/24 BRD 192.168.78.255 Scope Global eth1    inet6 fe80::20c:29ff:fe42:9fce/64 scope link        valid_lft forever preferred_lft forever[[email protected] Desktop]# IP A sh eth12:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up Qlen    00:0 link/ether C:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff    inet 192.168.78.129/24 BRD 192.168.78.255 scope global eth1    inet6 FE80: : 20c:29ff:fe42:9fce/64 scope link        valid_lft forever preferred_lft Forever

Add or remove IP addresses

IP a/addr/address add 192.168.78.130/24 dev eth1

IP a/addr/address del/delete 192.168.78.130/24 Dev eth1

[[Email protected] Desktop]# IP a add 192.168.78.130/24 dev eth1[[email protected] Desktop]# IP a sh eth12:eth1: <broadcast,mult Icast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen,    link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff    inet 192.168.78.129/24 BRD 192.168.78.255 scope global eth1    inet 192.168.78.130/24 scope Global Secondary eth1
   inet6 fe80::20c:29ff:fe42:9fce/64 scope link        valid_lft forever preferred_lft forever[[email protected] Desktop]# IP a D  El 192.168.78.130/24 Dev eth1[[email protected] Desktop]# IP a sh eth12:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU 1500 Qdisc pfifo_fast State up Qlen    link/ether 00:0c:29:42:9f:ce brd ff:ff:ff:ff:ff:ff inet    192.168.78.129/24 BR D 192.168.78.255 Scope Global eth1    inet6 fe80::20c:29ff:fe42:9fce/64 scope link        valid_lft forever preferred_lft Forever

Remove eth1 All IP addresses

IP a flush dev eth1

[[email protected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN LINK/LOOPBA CK 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 Scope host Valid_lft     Forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up Qlen 1000 Link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff inet 192.168.78.129/24 BRD 192.168.78.255 scope Global eth1 I Net6 fe80::20c:29ff:fe42:9fce/64 scope link Valid_lft forever preferred_lft forever[[email protected] Desktop]# IP A add 192.168.78.130/24 dev eth1[[email protected] Desktop]# ip a add 192.168.78.131/24 dev eth1[[email protected] Desktop ]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 0 0:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft fore Ver2:eth1: <broadcasT,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:f    F:ff inet 192.168.78.129/24 BRD 192.168.78.255 scope Global eth1 inet 192.168.78.130/24 scope Global Secondary eth1 inet 192.168.78.131/24 Scope Global secondary eth1 inet6 fe80::20c:29ff:fe42:9fce/64 scope link Valid_lft for Ever preferred_lft forever[[email protected] Desktop]# IP a flush dev eth1[[email protected] Desktop]# IP a1:lo: <LOOP Back,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 in ET 127.0.0.1/8 scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft forever2:eth1: &LT;BROADC Ast,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 00:0c:29:42:9f:ce BRD FF:FF:FF:FF : Ff:ff

Remove all IPV4 IP addresses from the eth1

Ip-4 a flush dev eth1

[[email protected] Desktop]# IP a 1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN LINK/LOOPB  Ack 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 Scope host Valid_lft Forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up Qlen 100    0 link/ether 00:0c:29:42:9f:ce brd ff:ff:ff:ff:ff:ff inet 192.168.78.129/24 BRD 192.168.78.255 Scope Global eth1  Inet6 fe80::20c:29ff:fe42:9fce/64 scope link Valid_lft forever preferred_lft forever[[email protected] Desktop]# IP A add 192.168.78.130/24 dev eth1[[email protected] Desktop]# IP a 1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 Qdisc Noq Ueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 Scope host Valid_lft forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Q Disc Pfifo_fast State up Qlen link/ether 00:0c:29:42:9f:ce brd ff:ff:ff:ff:ff:ff inet 192.168.78.129/24 BRD 192.168.78.255 Scope Global eth1 inet 192.168.78.130/24 Scope Global secondary eth1 inet6 fe80::20c:29ff:fe42:9fce/64 scope link valid_l FT Forever preferred_lft forever[[email protected] Desktop]# ip-4 a flush dev eth1[[email protected] Desktop]# IP a 1:lo : <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:0 0:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up Qlen Link/ether 00:0c:29:42:9f:ce BRD F F:ff:ff:ff:ff:ff inet6 fe80::20c:29ff:fe42:9fce/64 Scope link Valid_lft forever Preferred_lft forever

viewing network device information

IP link sh/show/l/list/ls

IP link sh/show/l/ls/lsit eth1

IP link sh/show/l/ls/list Dev eth1

[[Email protected] Desktop]# IP link l1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN     LINK/LOOPBA CK 00:00:00:00:00:00 BRD 00:00:00:00:00:002:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up Qlen    link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff[[email protected] Desktop]# IP link l eth12:eth1: &L T Broadcast,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen    , Link/ether 00:0c:29:42:9f:ce BRD FF: Ff:ff:ff:ff:ff[[email protected] Desktop]# IP link l Dev eth12:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc PF Ifo_fast state up Qlen    link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff

Stop and activate network devices

IP link set Dev eth1 down

IP link set Dev eth1 up

[[email protected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN LINK/LOOPBA CK 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 Scope host Valid_lft     Forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc pfifo_fast State up Qlen 1000 Link/ether 00:0c:29:42:9f:ce BRD ff:ff:ff:ff:ff:ff inet 192.168.78.133/24 BRD 192.168.78.255 scope Global eth1 I Net6 fe80::20c:29ff:fe42:9fce/64 scope link Valid_lft forever preferred_lft forever[[email protected] Desktop]# IP Link set dev eth1 down[[email protected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State U Nknown link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope Host Valid_lft Forever Preferred_lft forever2:eth1: <BROADCAST,MULTICAST> MTU Qdisc Pfifo_fast WN Qlen Link/ethEr 00:0c:29:42:9f:ce brd ff:ff:ff:ff:ff:ff inet 192.168.78.133/24 BRD 192.168.78.255 Scope Global Eth1[[email prot ected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN Link/loopback 00:00:00:00:00 : BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft Forever preferred _lft forever2:eth1: <BROADCAST,MULTICAST> MTU qdisc pfifo_fast State down Qlen + link/ether 00:0c:29:42: 9f:ce BRD ff:ff:ff:ff:ff:ff[[email protected] Desktop]# IP link set dev eth1 up[[email protected] Desktop]# IP a1:lo: &lt ;    Loopback,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft forever2:eth1: <br Oadcast,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 00:0c:29:42:9f:ce BRD ff:ff:f F:ff:ff:ff Inet6 Fe80::20C:29FF:FE42:9FCE/64 scope link Valid_lft forever preferred_lft forever[[email protected] Desktop]# IP a1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00: XX inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft forever2:eth1: &L T Broadcast,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 00:0c:29:42:9f:ce BRD FF:FF : Ff:ff:ff:ff inet 192.168.78.133/24 BRD 192.168.78.255 scope Global eth1 Inet6 FE80::20C:29FF:FE42:9FCE/64 Scope Lin K Valid_lft Forever Preferred_lft Forever

View the routing table

IP r/ro/route

IP R/ro/route sh/show

IP r/ro/route sh/show Dev eth1

[[Email protected] Desktop]# IP r192.168.78.0/24 dev eth2  proto kernel  scope link  src 192.168.78.132  metric 1 192.168.78.0/24 Dev eth1  proto kernel  scope link  src 192.168.78.133  metric 1 default via 192.168.78.2 Dev eth1  proto static [[email protected] Desktop]# IP r sh Dev eth1192.168.78.0/24  proto kernel  scope link  sr C 192.168.78.133  metric 1 default via 192.168.78.2  

Add or remove routes

IP r/ro/route add 192.168.79.0/24 dev eth1

IP r/ro/route d/del/delete 192.168.79.0/24

IP r/ro/route d/del/delete 192.168.79.0/24 Dev eth1

[[Email protected] Desktop]# IP r192.168.78.0/24 dev eth2  proto kernel  scope link  src 192.168.78.132  metric 1 192.168.78.0/24 Dev eth1  proto kernel  scope link  src 192.168.78.133  metric 1 default via 192.168.78.2 Dev eth1  proto static [[email protected] Desktop]# IP r add 192.168.79.0/24 dev Eth1[[email protected] Desktop]# IP r192.168.79. 0/24 Dev eth1  scope link 192.168.78.0/24 Dev eth2  proto kernel  scope link  src 192.168.78.132  Metric 1 192.168.78.0/24 Dev eth1  proto kernel  scope link  src 192.168.78.133  metric 1 default via 192 .168.78.2 Dev eth1  proto static [[email protected] Desktop]# IP r d 192.168.79.0/24 dev Eth1[[email protected] Desktop]# IP r19 2.168.78.0/24 Dev eth2  proto kernel  scope link  src 192.168.78.132  metric 1 192.168.78.0/24 Dev eth1  proto kernel  scope link  src 192.168.78.133  metric 1 default via 192.168.78.2 Dev eth1  

Deletion, addition, and modification of default routes

IP r/ro/route d/del/delete Default

IP r/ro/route add default via 192.168.78.1

IP r/ro/route chg/change default via 192.168.78.2

[[email protected] Desktop]# ip r192.168.78.0/24 dev eth1 proto kernel scope link src 192.168.78.133 metric 1 192.168. 78.0/24 Dev eth2 proto kernel scope link src 192.168.78.132 metric 1 default via 192.168.78.2 dev eth1 proto static [ [email protected] Desktop]# IP r d default[[email protected] Desktop]# ip r192.168.78.0/24 dev eth1 proto kernel scope l Ink src 192.168.78.133 metric 1 192.168.78.0/24 dev eth2 proto kernel scope link src 192.168.78.132 metric 1 [[Email  protected] Desktop]# IP r add default via 192.168.78.1[[email protected] Desktop]# ip r192.168.78.0/24 dev eth1 proto ke Rnel scope link src 192.168.78.133 metric 1 192.168.78.0/24 dev eth2 proto kernel scope link src 192.168.78.132 met Ric 1 default via 192.168.78.1 dev eth1 [[email protected] Desktop]# IP R chg default via 192.168.78.2[[email protect ed] Desktop]# ip r192.168.78.0/24 dev eth1 proto kernel scope link src 192.168.78.133 metric 1 192.168.78.0/24 Dev eth2 pr  OTO Kernel Scope linkSRC 192.168.78.132 metric 1 default via 192.168.78.2 Dev eth1  

viewing ARP Tables

IP N/neigh/neighbuor sh/show

[[Email protected] Desktop]# IP n192.168.78.2 dev eth1 lladdr 00:50:56:f0:d4:05 REACHABLE192.168.78.2 Dev eth2 lladdr 00:50:56: f0:d4:05 STALE192.168.78.254 Dev eth2 lladdr 00:50:56:f5:45:c8 STALE

Reference:

68939059

The IP of the Linux command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.