Linux Networking HOWTO | ||
---|---|---|
Prev | Chapter 10. Kernel 2.2 IP Command Reference (Work In Progress) | Next |
If you have the iproute2 tools installed, then executing the ip command will allow the basic syntax to be displayed.
[root@jd Net4]# ip Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { link | addr | route | rule | neigh | tunnel | maddr | mroute | monitor } OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 | dnet | link } | -o[neline] } |
There are also several options available:
-V, -Version -- print the version of the ip utility you are using and exit.
-s, -stats, -statistics -- obtain more output on the speficied device. You can issue this option more than once to increase the amount of information being displayed.
-f, -family followed by a protocol family identifier such as: inet, inet6 or link. -- Specify the exact protocol family to use. Inet uses the standard IPv4 (e.g.; current Internet standard), inet6 uses IPv6 (ground breadking, never to be implemented Internet standard), and link (a physical link). If you do not present the option, the protocol family is guessed. If not enough information is present, it will fallback to the default setting.
-o, -oneline Show the output each device record in a single line.
-r, -resolve Use the system resolver (e.g.; DNS) to print actual names (versus IP numbers).
OBJECT Is the object (device) that you can retrieve information from, and/or you can also manage the device. The current device types understood by the current implementation are:
link -- The network device e.g.; eth0 or ppp0 .
address -- The IP (IP or IPv6) address on the specified device.
neigh -- The ARP or NDISC cache entry.
route -- The routing table entry.
rule -- The rule in routing policy database.
maddress -- The multicast address.
mroute -- The multicast route cache entry.
tunnel -- Whether or not to tunnel over IP.
The amount of possible options allowed on each object type depend on the type of action being taken. As a basic rule, it is possible to add, delete, or to show the object(s). Not all object will allow additional commands to be used. Of course, command help is available for all objects. When help is used, it will print out a list of available sytanx conventions for the given object.
If you do not give a command, the default command will be assumed. Typically the default command is to list the objects.If the the objects can not be listed, the default will provide standard help output.
ARGUMENTS is the list of arguments that can be passed to the command. The number of arguments depends upon both the command and the object being used. There are two types of arguments:
Flags consist of a keyword followed by a value. For convenience, each command contains some default parameters that can be left out for easier use. For example, the parameter dev> defaults to an ip link.
Mistakes... thank God for smart coders! All the operations within the ip commands are dynamic. If the sytanx of the ip utility fails, it will not change the configuration of the system. There is an exception to this rule: the ip link command. This command is used to change part of a devices parameters.
It is difficult to list all the error messages (especially the syntax errors). Generally speaking, their meaning is clear in the context of the commands. The most common mistakes are: 1. Netlink is not configured in the kernel. The message is: Cannot open netlink socket: Invalid value
2. RTNETLINK is not configured in the kernel. One of the following messages may be printed (depending upon the command): Cannot talk to rtnetlink: Connection refused Cannot send dump request: Connection refused
3. Option CONFIG_IP_MULTIPLE_TABLES was not selected when configuring kernel. In this case, any attempt to use commandip rule will fail. For example:
jd@home $ ip rule list RTNETLINK error: Invalid argument dump terminated Was this section helpful? Why not Donate $2.50?