Naming convention standard for Ethernet and wifi interfaces in linux machines

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











up vote
1
down vote

favorite












I would like to know what is the naming convention standard for Ethernet and Wifi interfaces in linux machine.



we are developing a tool that should show only the Ethernet and wifi interface of the linux machine and its current status.



For ex, below are the list of network interfaces(both physical and virtual) in my linux(ubuntu) machine.



docker0, enp0s25, lo, wlp3s0



When I run the tool, below is the result I will be getting.



enp0s25, wlp3s0



we have written the code with the logic that all the ethernet interface always starts with word e and wifi interfaces always starts with word w.



Is the logic right, if not how can we address this?










share|improve this question



























    up vote
    1
    down vote

    favorite












    I would like to know what is the naming convention standard for Ethernet and Wifi interfaces in linux machine.



    we are developing a tool that should show only the Ethernet and wifi interface of the linux machine and its current status.



    For ex, below are the list of network interfaces(both physical and virtual) in my linux(ubuntu) machine.



    docker0, enp0s25, lo, wlp3s0



    When I run the tool, below is the result I will be getting.



    enp0s25, wlp3s0



    we have written the code with the logic that all the ethernet interface always starts with word e and wifi interfaces always starts with word w.



    Is the logic right, if not how can we address this?










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I would like to know what is the naming convention standard for Ethernet and Wifi interfaces in linux machine.



      we are developing a tool that should show only the Ethernet and wifi interface of the linux machine and its current status.



      For ex, below are the list of network interfaces(both physical and virtual) in my linux(ubuntu) machine.



      docker0, enp0s25, lo, wlp3s0



      When I run the tool, below is the result I will be getting.



      enp0s25, wlp3s0



      we have written the code with the logic that all the ethernet interface always starts with word e and wifi interfaces always starts with word w.



      Is the logic right, if not how can we address this?










      share|improve this question















      I would like to know what is the naming convention standard for Ethernet and Wifi interfaces in linux machine.



      we are developing a tool that should show only the Ethernet and wifi interface of the linux machine and its current status.



      For ex, below are the list of network interfaces(both physical and virtual) in my linux(ubuntu) machine.



      docker0, enp0s25, lo, wlp3s0



      When I run the tool, below is the result I will be getting.



      enp0s25, wlp3s0



      we have written the code with the logic that all the ethernet interface always starts with word e and wifi interfaces always starts with word w.



      Is the logic right, if not how can we address this?







      networking wifi network-interface ethernet






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago









      Rui F Ribeiro

      37.9k1475121




      37.9k1475121










      asked 3 hours ago









      Mohan Raj

      61




      61




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          2
          down vote













          The naming convention is that LAN interfaces are named eth0, eth1, ... and that WLAN interfaces are named wlan0, wlan1, ...



          What you see are the so called "predictable names" that systemd introduced. In practice, they are anything but predictable, and they can even change when the hardware is changed, which is exactly the problem they are supposed to avoid.



          For a guess the start letter may be good enough. Some interfaces, in particular WLAN, have hints in /sys/class/net/*/uevent:



          DEVTYPE=wlan


          Unfortunately, there is no such DEVTYPE for LAN interfaces.






          share|improve this answer



























            up vote
            2
            down vote













            For systemd predictable interface names, the prefixes can be seen in udev-builtin-net_id.c :



            * Two character prefixes based on the type of interface:
            * en — Ethernet
            * ib — InfiniBand
            * sl — serial line IP (slip)
            * wl — wlan
            * ww — wwan


            so for both the traditional ethX style of naming and the newer systemd naming, an initial letter e should be an ethernet interface for any automatically generated interface names. All wifi interfaces should begin with a w in both schemes, although not all interfaces beginning with w will be wifi.



            If this tool has to work in an arbitrary environment (rather than just on internal environments which you control), note that users may rename interfaces on linux systems with arbitrary names, such as [wan0, lan0, lan1, dmz0] which will break any assumptions about initial letters.






            share|improve this answer





























              up vote
              1
              down vote













              Network interfaces can be named anything, so no matter what you do, you'll run into situations where (1) there is a "physical" network interface with a name that didn't match your pattern, or (2) there is a "physical" network interface that will match your pattern.



              On top of that, if I was a user of your tool, the moment your tool wouldn't allow me to do something I want, because I have a network interface which is "virtual", though for practical purposes it should be considered "physical" in my setup, I'd start cursing loudly and forcefully at your app, and won't ever use it again.



              Physical and virtual network interfaces all share a common API are one thing which makes Linux really flexible. Please don't try to babysit your user, and take that away from him or her. Your users will thank you.






              share|improve this answer




















                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',
                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%2f479094%2fnaming-convention-standard-for-ethernet-and-wifi-interfaces-in-linux-machines%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote













                The naming convention is that LAN interfaces are named eth0, eth1, ... and that WLAN interfaces are named wlan0, wlan1, ...



                What you see are the so called "predictable names" that systemd introduced. In practice, they are anything but predictable, and they can even change when the hardware is changed, which is exactly the problem they are supposed to avoid.



                For a guess the start letter may be good enough. Some interfaces, in particular WLAN, have hints in /sys/class/net/*/uevent:



                DEVTYPE=wlan


                Unfortunately, there is no such DEVTYPE for LAN interfaces.






                share|improve this answer
























                  up vote
                  2
                  down vote













                  The naming convention is that LAN interfaces are named eth0, eth1, ... and that WLAN interfaces are named wlan0, wlan1, ...



                  What you see are the so called "predictable names" that systemd introduced. In practice, they are anything but predictable, and they can even change when the hardware is changed, which is exactly the problem they are supposed to avoid.



                  For a guess the start letter may be good enough. Some interfaces, in particular WLAN, have hints in /sys/class/net/*/uevent:



                  DEVTYPE=wlan


                  Unfortunately, there is no such DEVTYPE for LAN interfaces.






                  share|improve this answer






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    The naming convention is that LAN interfaces are named eth0, eth1, ... and that WLAN interfaces are named wlan0, wlan1, ...



                    What you see are the so called "predictable names" that systemd introduced. In practice, they are anything but predictable, and they can even change when the hardware is changed, which is exactly the problem they are supposed to avoid.



                    For a guess the start letter may be good enough. Some interfaces, in particular WLAN, have hints in /sys/class/net/*/uevent:



                    DEVTYPE=wlan


                    Unfortunately, there is no such DEVTYPE for LAN interfaces.






                    share|improve this answer












                    The naming convention is that LAN interfaces are named eth0, eth1, ... and that WLAN interfaces are named wlan0, wlan1, ...



                    What you see are the so called "predictable names" that systemd introduced. In practice, they are anything but predictable, and they can even change when the hardware is changed, which is exactly the problem they are supposed to avoid.



                    For a guess the start letter may be good enough. Some interfaces, in particular WLAN, have hints in /sys/class/net/*/uevent:



                    DEVTYPE=wlan


                    Unfortunately, there is no such DEVTYPE for LAN interfaces.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 3 hours ago









                    RalfFriedl

                    4,6061725




                    4,6061725






















                        up vote
                        2
                        down vote













                        For systemd predictable interface names, the prefixes can be seen in udev-builtin-net_id.c :



                        * Two character prefixes based on the type of interface:
                        * en — Ethernet
                        * ib — InfiniBand
                        * sl — serial line IP (slip)
                        * wl — wlan
                        * ww — wwan


                        so for both the traditional ethX style of naming and the newer systemd naming, an initial letter e should be an ethernet interface for any automatically generated interface names. All wifi interfaces should begin with a w in both schemes, although not all interfaces beginning with w will be wifi.



                        If this tool has to work in an arbitrary environment (rather than just on internal environments which you control), note that users may rename interfaces on linux systems with arbitrary names, such as [wan0, lan0, lan1, dmz0] which will break any assumptions about initial letters.






                        share|improve this answer


























                          up vote
                          2
                          down vote













                          For systemd predictable interface names, the prefixes can be seen in udev-builtin-net_id.c :



                          * Two character prefixes based on the type of interface:
                          * en — Ethernet
                          * ib — InfiniBand
                          * sl — serial line IP (slip)
                          * wl — wlan
                          * ww — wwan


                          so for both the traditional ethX style of naming and the newer systemd naming, an initial letter e should be an ethernet interface for any automatically generated interface names. All wifi interfaces should begin with a w in both schemes, although not all interfaces beginning with w will be wifi.



                          If this tool has to work in an arbitrary environment (rather than just on internal environments which you control), note that users may rename interfaces on linux systems with arbitrary names, such as [wan0, lan0, lan1, dmz0] which will break any assumptions about initial letters.






                          share|improve this answer
























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote









                            For systemd predictable interface names, the prefixes can be seen in udev-builtin-net_id.c :



                            * Two character prefixes based on the type of interface:
                            * en — Ethernet
                            * ib — InfiniBand
                            * sl — serial line IP (slip)
                            * wl — wlan
                            * ww — wwan


                            so for both the traditional ethX style of naming and the newer systemd naming, an initial letter e should be an ethernet interface for any automatically generated interface names. All wifi interfaces should begin with a w in both schemes, although not all interfaces beginning with w will be wifi.



                            If this tool has to work in an arbitrary environment (rather than just on internal environments which you control), note that users may rename interfaces on linux systems with arbitrary names, such as [wan0, lan0, lan1, dmz0] which will break any assumptions about initial letters.






                            share|improve this answer














                            For systemd predictable interface names, the prefixes can be seen in udev-builtin-net_id.c :



                            * Two character prefixes based on the type of interface:
                            * en — Ethernet
                            * ib — InfiniBand
                            * sl — serial line IP (slip)
                            * wl — wlan
                            * ww — wwan


                            so for both the traditional ethX style of naming and the newer systemd naming, an initial letter e should be an ethernet interface for any automatically generated interface names. All wifi interfaces should begin with a w in both schemes, although not all interfaces beginning with w will be wifi.



                            If this tool has to work in an arbitrary environment (rather than just on internal environments which you control), note that users may rename interfaces on linux systems with arbitrary names, such as [wan0, lan0, lan1, dmz0] which will break any assumptions about initial letters.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 1 hour ago

























                            answered 2 hours ago









                            user4556274

                            5,07811123




                            5,07811123




















                                up vote
                                1
                                down vote













                                Network interfaces can be named anything, so no matter what you do, you'll run into situations where (1) there is a "physical" network interface with a name that didn't match your pattern, or (2) there is a "physical" network interface that will match your pattern.



                                On top of that, if I was a user of your tool, the moment your tool wouldn't allow me to do something I want, because I have a network interface which is "virtual", though for practical purposes it should be considered "physical" in my setup, I'd start cursing loudly and forcefully at your app, and won't ever use it again.



                                Physical and virtual network interfaces all share a common API are one thing which makes Linux really flexible. Please don't try to babysit your user, and take that away from him or her. Your users will thank you.






                                share|improve this answer
























                                  up vote
                                  1
                                  down vote













                                  Network interfaces can be named anything, so no matter what you do, you'll run into situations where (1) there is a "physical" network interface with a name that didn't match your pattern, or (2) there is a "physical" network interface that will match your pattern.



                                  On top of that, if I was a user of your tool, the moment your tool wouldn't allow me to do something I want, because I have a network interface which is "virtual", though for practical purposes it should be considered "physical" in my setup, I'd start cursing loudly and forcefully at your app, and won't ever use it again.



                                  Physical and virtual network interfaces all share a common API are one thing which makes Linux really flexible. Please don't try to babysit your user, and take that away from him or her. Your users will thank you.






                                  share|improve this answer






















                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    Network interfaces can be named anything, so no matter what you do, you'll run into situations where (1) there is a "physical" network interface with a name that didn't match your pattern, or (2) there is a "physical" network interface that will match your pattern.



                                    On top of that, if I was a user of your tool, the moment your tool wouldn't allow me to do something I want, because I have a network interface which is "virtual", though for practical purposes it should be considered "physical" in my setup, I'd start cursing loudly and forcefully at your app, and won't ever use it again.



                                    Physical and virtual network interfaces all share a common API are one thing which makes Linux really flexible. Please don't try to babysit your user, and take that away from him or her. Your users will thank you.






                                    share|improve this answer












                                    Network interfaces can be named anything, so no matter what you do, you'll run into situations where (1) there is a "physical" network interface with a name that didn't match your pattern, or (2) there is a "physical" network interface that will match your pattern.



                                    On top of that, if I was a user of your tool, the moment your tool wouldn't allow me to do something I want, because I have a network interface which is "virtual", though for practical purposes it should be considered "physical" in my setup, I'd start cursing loudly and forcefully at your app, and won't ever use it again.



                                    Physical and virtual network interfaces all share a common API are one thing which makes Linux really flexible. Please don't try to babysit your user, and take that away from him or her. Your users will thank you.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 1 hour ago









                                    dirkt

                                    15.4k21132




                                    15.4k21132



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479094%2fnaming-convention-standard-for-ethernet-and-wifi-interfaces-in-linux-machines%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        List of Gilmore Girls characters

                                        Confectionery