21

I've been using the command /bin/ip:

ip addr add 10.10.10.0 dev eth0

I would like to see the source code of how the ip command works. Is it available?

Chadness3
  • 337
  • 3
    Are you looking for sources matching the distribution you are using? If so, you should mention which distribution you are using. – kasperd Aug 03 '17 at 21:38
  • 4
    We can help you better if you provide the Version and Distribution you are using and asking about. – mdpc Aug 03 '17 at 22:11
  • The ip utility is part of the iproute2 suite. – countermode Aug 04 '17 at 06:55
  • 2
    I'm voting to close this question as off-topic because asking for the source (code) of well-known software is most likely not useful for other U&L users. – countermode Aug 04 '17 at 06:59
  • @countermode It may be "well-known" to experts, but not to me and the other 4 who voted up.. Shouldn't questions that may be obvious to some still be left open for us less-enlightened individuals? – Chadness3 Aug 07 '17 at 15:09
  • It does not require advanced searches on bing/google to find out where ip comes from (admitted, you have to be more careful with the query). U&L is a knowledge base for solving problems and in this sense I still claim that neither the question nor the answers to it contribute to U&L. This has nothing to do with enlightened or not enlightened, this has to do with the concept of U&L. You may want to have a look at http://www.catb.org/esr/faqs/smart-questions.html, especially the Section "Before You Ask" (inspired by Jeff Schaller here on U&L). – countermode Aug 08 '17 at 07:20
  • 1000 views on this question. I guess this wasn't "off-topic" after all. – Chadness3 Jul 10 '18 at 15:36
  • It is not off topic, today is 2022 and I am looking for this! – Max Jan 26 '22 at 03:59
  • @countermode I'm very glad I found this. Very much on topic! – rustyx May 20 '22 at 16:37

1 Answers1

30

The ip program is part of the iproute2 software package, and can be downloaded from www.kernel.org. N.b. Unlike the old ipconfig program, which uses ioctls to do its job, the iproute2 utilities use Netlink sockets to communicate with the kernel. It helps understanding how the ip program works if you are familiarised with Netlink sockets.

Johan Myréen
  • 13,168