Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the ip command in Linux

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what is the use of the ip command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Linux commonly used commands ip commands are used to display or manipulate the routes, network devices, policy routes and tunnels of Linux hosts. It is a new and powerful network configuration tool under Linux.

Ip Network configuration tool

It is added that the ip command is used to display or manipulate the routes, network devices, policy routes and tunnels of Linux hosts. It is a new and powerful network configuration tool under Linux.

Syntax ip (option) (parameter) Usage: ip [OPTIONS] OBJECT {COMMAND | help} ip [- force]-batch filename option OBJECT: = {link | address | addrlabel | route | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | macsec | tcp_metrics | token}-V: display instruction version information;-s: output more detailed information -f: force the specified protocol family to be used;-4: specify that the network layer protocol used is IPv4 protocol;-6: specify that the network layer protocol used is IPv6 protocol;-0: output one line for each record, even if there is more content;-r: when displaying the host, use the host's domain name instead of the IP address. Parameter OPTIONS: = {- V [ersion] |-s [tatistics] |-d [etails] |-r [esolve] |-h [uman-readable] |-iec |-f [amily] {inet | inet6 | dnet | bridge | link} |-4 |-6 |-I |-D |-0 |-l [oops] {maximum-addr-flush-attempts} |-o [neline] | |-t [imestamp] |-ts [hort] |-b [atch] [filename] |-rc [vbuf] [size] |-n [etns] name |-a [ll]} Network object: specify the network object to be managed Specific operation: complete the specific operation on the specified network object; help: display the help information of the operation commands supported by the network object. Example ip link show # displays the network interface information ip link set eth0 up # enables the network card ip link set eth0 down # turns off the network card ip link set eth0 promisc on # turns on the mixed mode ip link set eth0 promisc offi # turns off the mixed mode ip link set eth0 txqueuelen 1200 # sets the queue length of the network card ip link set eth0 mtu 1400 # set the maximum transmission unit of the network card ip addr show # display the network card IP information ip addr add 192.168.0.1 ip addr del 24 dev eth0 # set the eth0 network card IP address 192.168.0.1 ip addr del 192.168.0.1 IP address ip route show # display the system route ip route add default via 192.168.1.254 # set the system default route Ip route list # View routing information ip route add 192.168.4.0 dev eth0 24 via 192.168.0.254 set the gateway of the 192.168.4.0 network segment to 192.168.0.254 The data goes through the eth0 interface ip route add default via 192.168.0.254 dev eth0 # sets the default gateway to 192.168.0.254 ip route del 192.168.4.0 ip route del 24 # Delete the gateway of the 192.168.4.0 segment ip route del default # Delete the default route ip route delete 192.168.1.0 ip route delete 24 dev eth0 # Delete the route display the operational status of the network device with the ip command

[root@localhost ~] # ip link list 1: lo:mtu 16436 qdisc noqueue link/loopback 00 qdisc pfifo_fast qlen 00 00 link/ether 00:16:3e:00:1e:52 brd ff:ff:ff: eth0:mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff 3: eth2:mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:52 brd ff:ff:ff Ff:ff:ff displays more detailed device information

[root@localhost ~] # ip-s link list 1: lo:mtu 16436 qdisc noqueue link/loopback 0000 qdisc 0000 brd 0000 brd 0000VlV 00000000 RX: bytes packets errors dropped overrun mcast 5082831 56145 00 00 TX: bytes packets errors dropped carrier collsns 5082831 56145 00 00 2: eth0:mtu 1500 qdisc Pfifo_fast qlen 1000 link/ether 00:16:3e:00:1e:51 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 3641655380 62027099 000 0 TX: bytes packets errors dropped carrier collsns 6155236 89160 000 0 3: eth2:mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:3e:00 1e:52 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 2562136822 488237847 000 TX: bytes packets errors dropped carrier collsns 3486617396 9691081 000 shows the core routing table

[root@localhost ~] # ip route list 112.124.12.0 dev eth2 proto kernel scope link src 22 dev eth2 proto kernel scope link src 112.124.15.130 10.160.0.0 dev eth2 20 dev eth0 proto kernel scope link src 10.160.7.81 192.168.0 dev eth2 16 via 10.160.15.247 dev eth0 172.16.0.0shock 12 via 10.160.15.247 dev eth0 10.0.0.0amp8 via 10.160.15.247 dev eth0 default via 112.124.15.247 dev eth2 shows the neighbor table

[root@localhost ~] # ip neigh list 112.124.15.247 dev eth2 lladdr 00:00:0c:9f:f3:88 REACHABLE 10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE get all network interfaces of the host

Ip link | grep-E'^ [0-9]'| awk-F:'{print $2}'is all the content of the article "what is the use of ip commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report