The ip
command is similar to the ifconfig
command, but more powerful than the ifconfig
command. Its main function is to display or set the configuration of network devices, routes, and tunnels. The ip
command is an enhanced version of the network configuration tool in Linux
, used to replace the ifconfig
command.
ip [ OPTIONS ] OBJECT { COMMAND | help }
ip [ -force ] -batch filename
OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm | netns }
OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] }
-b, -batch <FILENAME>
: Read commands from the provided file or standard input, the first failure will lead to the termination of theip
execution.-force
: Do not terminateip
due to errors in batch mode. If any error occurs during command execution, the application return code will be non-zero.-s, -stats, -statistics
: Output more information. If this option appears two or more times, the amount of information will increase. Typically, the information is statistical information or some time values.-l, -loops <COUNT>
: Specify the maximum number of loops attempted byip addr flush
before giving up. The default value is10
,0
means looping until all addresses are deleted.-f, -family <FAMILY>
: Specify the protocol family used. The protocol family identifier can be one ofinet
,inet6
,bridge
,ipx
,dnet
, orlink
. If this option does not exist, the protocol family is guessed based on other parameters. If the rest of the command line does not provide enough information to guess the family,ip
will fall back to the defaultip
setting, usuallyinet
orany
.link
is a special family identifier that does not involve any network protocols.-4
: Shortcut for-family inet
.-6
: Shortcut for-family inet6
.-B
: Shortcut for-family bridge
.-D
: Shortcut for-family decnet
.-I
: Shortcut for-family ipx
.-0
: Shortcut for-family link
.-o, -oneline
: Output each record as a single line, replacing newline characters with\
character. This is convenient when counting records withwc
or grepping the output.-r, -resolve
: PrintDNS
names using the system's name resolution program instead of host addresses.-V, -Version
: Output version information.
address
: Protocol address on a device,IP
orIPv6
.addrlabel
: Label configuration used for protocol address selection.l2tp
: IP tunnel EthernetL2TPv3
.link
: Network device.maddress
: Multicast addresses.monitor
: Monitornetlink
messages.mroute
: Multicast routing cache entry.mrule
: Rule in the multicast routing policy database.neighbour
: ManageARP
orNDISC
cache entries.netns
: Manage network namespaces.ntable
: Operations on the neighbour cache.route
: Routing table entry.rule
: Rule in the routing policy database.tcp_metrics/tcpmetrics
: ManageTCP
metrics.tunnel
:IP
tunnel.tuntap
: ManageTUN/TAP
devices.xfrm
: ManageIPSec
policies.
To view network interface information, such as IP
addresses and subnets.
ip addr show
To view information about the eth0
network card.
ip addr show eth0
To enable a network interface.
ip link set eth0 up
To disable a network interface.
ip link set eth0 down
To view routing and default gateway information.
ip route show
To get routing information for a specific IP
.
ip route get to 192.168.111.111
To view arp
entries.
ip neigh
To view network statistics.
ip -s link
For detailed help information.
man ip
https://github.com/WindrunnerMax/EveryDay
https://www.computerhope.com/unix/ip.htm
https://www.commandlinux.com/man-page/man8/ip.8.html
https://www.geeksforgeeks.org/ip-command-in-linux-with-examples/