How to get the IPV4 address for an interface from /proc

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












19















Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface?

Ideally I would just type cat /proc/<foo>/interface_name and get the IPv4 address.



I'd rather not run anything other than cat.










share|improve this question




























    19















    Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface?

    Ideally I would just type cat /proc/<foo>/interface_name and get the IPv4 address.



    I'd rather not run anything other than cat.










    share|improve this question


























      19












      19








      19


      2






      Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface?

      Ideally I would just type cat /proc/<foo>/interface_name and get the IPv4 address.



      I'd rather not run anything other than cat.










      share|improve this question
















      Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface?

      Ideally I would just type cat /proc/<foo>/interface_name and get the IPv4 address.



      I'd rather not run anything other than cat.







      linux ip proc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 26 at 13:25









      fra-san

      1,8751620




      1,8751620










      asked May 15 '17 at 17:53









      razehrazeh

      196114




      196114




















          1 Answer
          1






          active

          oldest

          votes


















          16














          Under the /proc directory, you can also find the IPv4 addresses in the Forwarding Information Base table, at /proc/net/fib_trie



          The table is pretty intelligible doing a mere cat, first comes the Main: and then Local:



          cat /proc/net/fib_trie


          or to see your network, IP addresses and netmask:



          cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255





          share|improve this answer




















          • 1





            Is there a way to get the interface for each IP address?

            – razeh
            May 15 '17 at 18:18











          • They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

            – Rui F Ribeiro
            May 15 '17 at 18:27







          • 1





            /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

            – villapx
            May 15 '17 at 18:47






          • 1





            @villapx fib_trie is not present on 2.6 kernels.

            – Rui F Ribeiro
            Sep 27 '18 at 15:07











          • There's no way to associate ip addresses with interface in fib_trie.

            – ZioByte
            Mar 10 at 21:38










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f365225%2fhow-to-get-the-ipv4-address-for-an-interface-from-proc%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          16














          Under the /proc directory, you can also find the IPv4 addresses in the Forwarding Information Base table, at /proc/net/fib_trie



          The table is pretty intelligible doing a mere cat, first comes the Main: and then Local:



          cat /proc/net/fib_trie


          or to see your network, IP addresses and netmask:



          cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255





          share|improve this answer




















          • 1





            Is there a way to get the interface for each IP address?

            – razeh
            May 15 '17 at 18:18











          • They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

            – Rui F Ribeiro
            May 15 '17 at 18:27







          • 1





            /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

            – villapx
            May 15 '17 at 18:47






          • 1





            @villapx fib_trie is not present on 2.6 kernels.

            – Rui F Ribeiro
            Sep 27 '18 at 15:07











          • There's no way to associate ip addresses with interface in fib_trie.

            – ZioByte
            Mar 10 at 21:38















          16














          Under the /proc directory, you can also find the IPv4 addresses in the Forwarding Information Base table, at /proc/net/fib_trie



          The table is pretty intelligible doing a mere cat, first comes the Main: and then Local:



          cat /proc/net/fib_trie


          or to see your network, IP addresses and netmask:



          cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255





          share|improve this answer




















          • 1





            Is there a way to get the interface for each IP address?

            – razeh
            May 15 '17 at 18:18











          • They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

            – Rui F Ribeiro
            May 15 '17 at 18:27







          • 1





            /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

            – villapx
            May 15 '17 at 18:47






          • 1





            @villapx fib_trie is not present on 2.6 kernels.

            – Rui F Ribeiro
            Sep 27 '18 at 15:07











          • There's no way to associate ip addresses with interface in fib_trie.

            – ZioByte
            Mar 10 at 21:38













          16












          16








          16







          Under the /proc directory, you can also find the IPv4 addresses in the Forwarding Information Base table, at /proc/net/fib_trie



          The table is pretty intelligible doing a mere cat, first comes the Main: and then Local:



          cat /proc/net/fib_trie


          or to see your network, IP addresses and netmask:



          cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255





          share|improve this answer















          Under the /proc directory, you can also find the IPv4 addresses in the Forwarding Information Base table, at /proc/net/fib_trie



          The table is pretty intelligible doing a mere cat, first comes the Main: and then Local:



          cat /proc/net/fib_trie


          or to see your network, IP addresses and netmask:



          cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255
          |-- 193.136.1.0
          |-- 193.136.1.2
          |-- 193.136.1.255






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 22 '18 at 8:46

























          answered May 15 '17 at 18:16









          Rui F RibeiroRui F Ribeiro

          41.7k1483141




          41.7k1483141







          • 1





            Is there a way to get the interface for each IP address?

            – razeh
            May 15 '17 at 18:18











          • They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

            – Rui F Ribeiro
            May 15 '17 at 18:27







          • 1





            /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

            – villapx
            May 15 '17 at 18:47






          • 1





            @villapx fib_trie is not present on 2.6 kernels.

            – Rui F Ribeiro
            Sep 27 '18 at 15:07











          • There's no way to associate ip addresses with interface in fib_trie.

            – ZioByte
            Mar 10 at 21:38












          • 1





            Is there a way to get the interface for each IP address?

            – razeh
            May 15 '17 at 18:18











          • They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

            – Rui F Ribeiro
            May 15 '17 at 18:27







          • 1





            /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

            – villapx
            May 15 '17 at 18:47






          • 1





            @villapx fib_trie is not present on 2.6 kernels.

            – Rui F Ribeiro
            Sep 27 '18 at 15:07











          • There's no way to associate ip addresses with interface in fib_trie.

            – ZioByte
            Mar 10 at 21:38







          1




          1





          Is there a way to get the interface for each IP address?

          – razeh
          May 15 '17 at 18:18





          Is there a way to get the interface for each IP address?

          – razeh
          May 15 '17 at 18:18













          They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

          – Rui F Ribeiro
          May 15 '17 at 18:27






          They appear in a pre-determined order; probably priority, but that can be changed; other than that, no.

          – Rui F Ribeiro
          May 15 '17 at 18:27





          1




          1





          /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

          – villapx
          May 15 '17 at 18:47





          /proc/net/fib_trie isn't available on my RHEL 6.6 system here at work

          – villapx
          May 15 '17 at 18:47




          1




          1





          @villapx fib_trie is not present on 2.6 kernels.

          – Rui F Ribeiro
          Sep 27 '18 at 15:07





          @villapx fib_trie is not present on 2.6 kernels.

          – Rui F Ribeiro
          Sep 27 '18 at 15:07













          There's no way to associate ip addresses with interface in fib_trie.

          – ZioByte
          Mar 10 at 21:38





          There's no way to associate ip addresses with interface in fib_trie.

          – ZioByte
          Mar 10 at 21:38

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f365225%2fhow-to-get-the-ipv4-address-for-an-interface-from-proc%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay