Determine if it's a static IP or a DHCP IP











up vote
1
down vote

favorite
2












I'm trying to find a genric solution across all linux distro to find if the IP address attached to the system is a static or a DHCP ?



On ubuntu , I can find if it's static or DHCP by doing a DHCP grep on /var/log/syslog but it is not generic solution , it might differ on other platforms.



One of the target board is Cortina and I'm using open wrt as a boot up kernel for that. There is no var/log/syslog on Cortina nothing similar to that also.










share|improve this question
























  • If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
    – Kinnectus
    Aug 12 '15 at 8:35










  • @BigChris ifconfig interface doesn't display anything about the type of connection :/
    – Neetz
    Aug 12 '15 at 9:21










  • In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
    – qasdfdsaq
    Aug 12 '15 at 10:26












  • I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
    – Kinnectus
    Aug 12 '15 at 10:39















up vote
1
down vote

favorite
2












I'm trying to find a genric solution across all linux distro to find if the IP address attached to the system is a static or a DHCP ?



On ubuntu , I can find if it's static or DHCP by doing a DHCP grep on /var/log/syslog but it is not generic solution , it might differ on other platforms.



One of the target board is Cortina and I'm using open wrt as a boot up kernel for that. There is no var/log/syslog on Cortina nothing similar to that also.










share|improve this question
























  • If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
    – Kinnectus
    Aug 12 '15 at 8:35










  • @BigChris ifconfig interface doesn't display anything about the type of connection :/
    – Neetz
    Aug 12 '15 at 9:21










  • In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
    – qasdfdsaq
    Aug 12 '15 at 10:26












  • I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
    – Kinnectus
    Aug 12 '15 at 10:39













up vote
1
down vote

favorite
2









up vote
1
down vote

favorite
2






2





I'm trying to find a genric solution across all linux distro to find if the IP address attached to the system is a static or a DHCP ?



On ubuntu , I can find if it's static or DHCP by doing a DHCP grep on /var/log/syslog but it is not generic solution , it might differ on other platforms.



One of the target board is Cortina and I'm using open wrt as a boot up kernel for that. There is no var/log/syslog on Cortina nothing similar to that also.










share|improve this question















I'm trying to find a genric solution across all linux distro to find if the IP address attached to the system is a static or a DHCP ?



On ubuntu , I can find if it's static or DHCP by doing a DHCP grep on /var/log/syslog but it is not generic solution , it might differ on other platforms.



One of the target board is Cortina and I'm using open wrt as a boot up kernel for that. There is no var/log/syslog on Cortina nothing similar to that also.







linux networking ubuntu dhcp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 '15 at 8:07









WaQaR Ali

1156




1156










asked Aug 12 '15 at 7:29









Neetz

1516




1516












  • If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
    – Kinnectus
    Aug 12 '15 at 8:35










  • @BigChris ifconfig interface doesn't display anything about the type of connection :/
    – Neetz
    Aug 12 '15 at 9:21










  • In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
    – qasdfdsaq
    Aug 12 '15 at 10:26












  • I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
    – Kinnectus
    Aug 12 '15 at 10:39


















  • If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
    – Kinnectus
    Aug 12 '15 at 8:35










  • @BigChris ifconfig interface doesn't display anything about the type of connection :/
    – Neetz
    Aug 12 '15 at 9:21










  • In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
    – qasdfdsaq
    Aug 12 '15 at 10:26












  • I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
    – Kinnectus
    Aug 12 '15 at 10:39
















If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
– Kinnectus
Aug 12 '15 at 8:35




If you ifconfig <your_interface> and look at the flags listed, you may be able to find "DHCP" - this may be a little more generic across distros
– Kinnectus
Aug 12 '15 at 8:35












@BigChris ifconfig interface doesn't display anything about the type of connection :/
– Neetz
Aug 12 '15 at 9:21




@BigChris ifconfig interface doesn't display anything about the type of connection :/
– Neetz
Aug 12 '15 at 9:21












In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
– qasdfdsaq
Aug 12 '15 at 10:26






In that case there's no method universal across all linux distros. There is a syslog on openwrt though which will tell you this though. It's just not a file.
– qasdfdsaq
Aug 12 '15 at 10:26














I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
– Kinnectus
Aug 12 '15 at 10:39




I only did a quick look up and came across this resource: unix.com/unix-for-dummies-questions-and-answers/…
– Kinnectus
Aug 12 '15 at 10:39










3 Answers
3






active

oldest

votes

















up vote
1
down vote













The problem is, if you're using NetworkManager, for example, it's going to be requesting an IP and gateway and DNS server. But beyond that, once it's got the information it needs, it sets addressing information essentially statically. Essentially, the rest of your machine doesn't know or care if an address is static or dynamic, just that it has an address.



You can check /var/log/syslog for DHCPACK entries specifically. I believe dhclient and NetworkManager write there.






share|improve this answer




























    up vote
    1
    down vote













    Type in terminal




    cat /etc/network/interfaces




    You should find one of this lines




    iface eth0 inet dhcp




    that means that IP for interface eth0 is from DHCP




    iface eth0 inet static




    Above line shows that IP is static. You should also find other parameters.






    share|improve this answer

















    • 1




      What does it mean if the result is iface lo inet loopback?
      – Magick
      Feb 22 at 1:42


















    up vote
    0
    down vote













    If its CentOS, you can check /etc/sysconfig/network-scripts/ifcfg-eth0. Check BOOTPROTO entry says. If its dhcp then its DHCP configured. If its Static or none, then its not DHCP






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      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',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fsuperuser.com%2fquestions%2f955790%2fdetermine-if-its-a-static-ip-or-a-dhcp-ip%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      The problem is, if you're using NetworkManager, for example, it's going to be requesting an IP and gateway and DNS server. But beyond that, once it's got the information it needs, it sets addressing information essentially statically. Essentially, the rest of your machine doesn't know or care if an address is static or dynamic, just that it has an address.



      You can check /var/log/syslog for DHCPACK entries specifically. I believe dhclient and NetworkManager write there.






      share|improve this answer

























        up vote
        1
        down vote













        The problem is, if you're using NetworkManager, for example, it's going to be requesting an IP and gateway and DNS server. But beyond that, once it's got the information it needs, it sets addressing information essentially statically. Essentially, the rest of your machine doesn't know or care if an address is static or dynamic, just that it has an address.



        You can check /var/log/syslog for DHCPACK entries specifically. I believe dhclient and NetworkManager write there.






        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          The problem is, if you're using NetworkManager, for example, it's going to be requesting an IP and gateway and DNS server. But beyond that, once it's got the information it needs, it sets addressing information essentially statically. Essentially, the rest of your machine doesn't know or care if an address is static or dynamic, just that it has an address.



          You can check /var/log/syslog for DHCPACK entries specifically. I believe dhclient and NetworkManager write there.






          share|improve this answer












          The problem is, if you're using NetworkManager, for example, it's going to be requesting an IP and gateway and DNS server. But beyond that, once it's got the information it needs, it sets addressing information essentially statically. Essentially, the rest of your machine doesn't know or care if an address is static or dynamic, just that it has an address.



          You can check /var/log/syslog for DHCPACK entries specifically. I believe dhclient and NetworkManager write there.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 15 '15 at 21:52









          hlmtre

          314




          314
























              up vote
              1
              down vote













              Type in terminal




              cat /etc/network/interfaces




              You should find one of this lines




              iface eth0 inet dhcp




              that means that IP for interface eth0 is from DHCP




              iface eth0 inet static




              Above line shows that IP is static. You should also find other parameters.






              share|improve this answer

















              • 1




                What does it mean if the result is iface lo inet loopback?
                – Magick
                Feb 22 at 1:42















              up vote
              1
              down vote













              Type in terminal




              cat /etc/network/interfaces




              You should find one of this lines




              iface eth0 inet dhcp




              that means that IP for interface eth0 is from DHCP




              iface eth0 inet static




              Above line shows that IP is static. You should also find other parameters.






              share|improve this answer

















              • 1




                What does it mean if the result is iface lo inet loopback?
                – Magick
                Feb 22 at 1:42













              up vote
              1
              down vote










              up vote
              1
              down vote









              Type in terminal




              cat /etc/network/interfaces




              You should find one of this lines




              iface eth0 inet dhcp




              that means that IP for interface eth0 is from DHCP




              iface eth0 inet static




              Above line shows that IP is static. You should also find other parameters.






              share|improve this answer












              Type in terminal




              cat /etc/network/interfaces




              You should find one of this lines




              iface eth0 inet dhcp




              that means that IP for interface eth0 is from DHCP




              iface eth0 inet static




              Above line shows that IP is static. You should also find other parameters.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 16 '16 at 9:20









              GarryMoveOut

              112




              112








              • 1




                What does it mean if the result is iface lo inet loopback?
                – Magick
                Feb 22 at 1:42














              • 1




                What does it mean if the result is iface lo inet loopback?
                – Magick
                Feb 22 at 1:42








              1




              1




              What does it mean if the result is iface lo inet loopback?
              – Magick
              Feb 22 at 1:42




              What does it mean if the result is iface lo inet loopback?
              – Magick
              Feb 22 at 1:42










              up vote
              0
              down vote













              If its CentOS, you can check /etc/sysconfig/network-scripts/ifcfg-eth0. Check BOOTPROTO entry says. If its dhcp then its DHCP configured. If its Static or none, then its not DHCP






              share|improve this answer

























                up vote
                0
                down vote













                If its CentOS, you can check /etc/sysconfig/network-scripts/ifcfg-eth0. Check BOOTPROTO entry says. If its dhcp then its DHCP configured. If its Static or none, then its not DHCP






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  If its CentOS, you can check /etc/sysconfig/network-scripts/ifcfg-eth0. Check BOOTPROTO entry says. If its dhcp then its DHCP configured. If its Static or none, then its not DHCP






                  share|improve this answer












                  If its CentOS, you can check /etc/sysconfig/network-scripts/ifcfg-eth0. Check BOOTPROTO entry says. If its dhcp then its DHCP configured. If its Static or none, then its not DHCP







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 29 at 6:53









                  Chandrasekar

                  21125




                  21125






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2fsuperuser.com%2fquestions%2f955790%2fdetermine-if-its-a-static-ip-or-a-dhcp-ip%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

                      Probability when a professor distributes a quiz and homework assignment to a class of n students.

                      Aardman Animations

                      Are they similar matrix