See the ipup init script in Chapter This information is cached on the local system for some time typically about 15 minutes to avoid having to query during follow up communication. Prepend does the same thing as the classic route add command by adding the route even if another route to the same destination already exists. Linux kernel implements only handling of data frames, so you can create only unmanaged tunnels with iproute2, with tutorkal settings configured manually on both sides. Instead, we will talk about what these are and what situations you may find them useful. Traditionally, the ifconfig command was used to configure items in this area. Another method to disable IP on an interface using ip addr flush is discussed later.

Author:Tojazilkree Tekasa
Language:English (Spanish)
Published (Last):9 December 2004
PDF File Size:5.15 Mb
ePub File Size:5.75 Mb
Price:Free* [*Free Regsitration Required]

Become an author Introduction It is essential to have an understanding of basic networking tools when administering and troubleshooting Linux servers.

While some tools are made primarily for monitoring, other low-level utilities are used to configure the network connection itself and implement default settings. Traditionally, a group of unrelated tools lumped together under the title of net-tools was used to do this. They were often packaged together to provide full functionality coverage, but their development and usage strategy varied from tool to tool.

Because of inconsistencies, as well as halted maintenance, a collection of tools known under the umbrella moniker iproute2 has been used to replace these separate tools. They have been developed in tandem to share syntax and operate together efficiently.

In this guide, we will discuss how to use the iproute2 tools to configure, manipulate, and gather information about your network. We will be using an Ubuntu While the querying commands can usually be executed as an unprivileged user, root privileges must be used to modify settings.

How To View Network Interfaces, Addresses, and Routes One of the most fundamental responsibilities of the iproute2 suite is to manage actual interfaces. Usually, the interfaces themselves will be named things like eth0, eth1, lo, etc. Traditionally, the ifconfig command was used to configure items in this area.

Under the iproute2 system, the subcommands ip addr and ip link take care of these steps. With ifconfig, you could gather information about the current state of your network interfaces by typing the command with no arguments: ifconfig eth0 Link encap:Ethernet HWaddr be:fcb inet addr The routing table contains kernel information about the paths to other network locations. We can print off the current routing table by typing: ip route show default via We can access this server through that interface, where our own interface address is How To Configure Network Interfaces and Addresses Now that you are familiar with how to get information about the interfaces and addresses associated with them, the next step is to find out how to modify their states.

The first step is to configure the interface itself. You can do this with the ip link subcommand again. This time, however, you pass the action set instead of show in order to modify values.

For instance, we can bring a network interface up or down by issuing these: ip link set eth1 up ip link set eth1 down Note: Be careful not to accidentally bring down the interface that you are connected to your server through. You can also use the ip link subcommand to set attributes about the interface. For instance, if you would like to change the multicast flag on or off for your interface, you can type: ip link set eth1 multicast on ip link set eth1 multicast off You can adjust the mtu and package queue length like this: ip link set eth1 mtu ip link set eth1 txqueuelen If the interface you are configuring is down, you can adjust the interface name and the arp flag associated with the device: ip link set eth1 name eth10 ip link set eth1 arp on To adjust the addresses associated with the interfaces, we again use the ip addr subcommand.

Multiple addresses can be added to each interface without a problem. We can get rid of addresses with the inverse operation. Additional Capabilities of IPRoute2 IPRoute2 has some additional capabilities that we will not be able to discuss in-depth in this guide. Instead, we will talk about what these are and what situations you may find them useful.

The idea of IP routing rules is difficult to talk about because it is very situation dependent. Basically, you can decide on how to route traffic based on a number of fields, including target address, source address, routing protocol, packet size, etc.

We access this functionality by using the ip rule subcommand. The basic querying follows the general pattern of the other subcommands: ip rule show 0: from all lookup local from all lookup main from all lookup default These three routing rules are the default rules configured by the kernel. The first line matches any traffic and is used to route high priority traffic. The second line is the main rule that handles normal routing.

Routing rules, as configured by the IPRoute2 software, are stored in a routing policy database, where the policy is selected by matching against sets of rules.

We can add or delete rules using the appropriate actions. You should not do this without knowing what you are doing however. Look at the man pages and search for ip rule for more information. The subcommand that deals with this information is called ip neigh. Arp is a protocol used to gather information about physical devices accessible through the local network.

Basically, an arp request is broadcast over the local network whenever an IP address needs to be reached. The matching IP address responds and then the local computer knows where to send information to that IP address. This information is cached on the local system for some time typically about 15 minutes to avoid having to query during follow up communication. Conclusion You should now have a fairly good idea of how to use the tools included in the iproute2 suite.

While many guides and tutorials still refer to the old utilities, partly because knowledgeable system admins often grew up using the older tools, the commands discussed in this guide will be taking over in the coming years. It is important to familiarize yourself with these commands now before you find yourself troubleshooting issues on a system that has switched to these commands Arch Linux already fully converted in In general, they are much more consistent, and you can count on certain conventions being available in all of the commands.

The more you use these commands, the more they will become second nature. By Justin Ellingwood.


Task-centered iproute2 user guide

However having used the trusted ifconfig, route and arp for so many years, I have never bothered to use ip and hence I now need to Google every time I want to see what my IP address is! Find IP addresses of all active interfaces, equivalent of ifconfig ip addr show up Alternatively, if you want to see all the interfaces irrespective of their status, equivalent of ifconfig -a ip addr Assign an IP address to an interface, equivalient of ifconfig eth0 Using iproute2 you can add multiple ip addresses to the same interface without the use of interface tags like eth Mark an interface active or bring up an interface, equivalent of ifconfig eth0 up sudo ip addr link set eth0 up Mark an interface inactive or bring down an interface, equivalent of ifconfig eth0 down sudo ip addr link set eth0 down Enable promisc flag on interfaces, equivalent of ifconfig eth0 promisc sudo ip link set dev eth0 promisc on Disable promisc flag on interfaces, equivalent of ifconfig eth0 -promisc sudo ip link set dev eth0 promisc off Mac Address spoofing, equivalent of ifconfig eth0 hw ether aa:bb:cc:dd:ee:ff ip link set dev eth0 down ip link set dev eth0 address aa:bb:cc:dd:ee:ff ip link set dev eth0 up Display the arp cache, equivalent of arp -an ip neigh show To see arp cache for a specific interface ip neigh show dev eth0 To see the arp entry for a specific ip address ip neigh show For more information refer to the man pages.


iproute2 tutorial for ifconfig, arp, route users

Arashir This type of tunnels will be widely used when transit operators phase IPv4 out i. Each device must have at least one address in order to use the corresponding protocol. IP Global Command Syntax. Moreover, when you move an interface to another namespace, it loses all existing configuration such as IP addresses configured on it and goes to DOWN state. What we are showing here is that unlike the behaviour in the 2. If the netmask does not exist then we call the standard class netmask function jproute2 determine the standard class for the given ip address. Create the routes and rules.

AFI 36-3208 PDF


That is, both If you are not sure if something is a correct host address, use ipcalc or similar program to check. If you add more than one address, your machine will accept packets for all of them. All additional addresses you set will become secondary addresses. Linux does allow the same address to be configured on multiple interfaces and it has valid use cases. Try to always set the primary address first. However, if the sysctl variable net.

Related Articles