How to use same interfaces settings for all wlan devices












4















I am working with a pcengines apu2c4 board with debian 8.4 installed.Obviously when you insert a wifi dongle new to the machine it is given wlan0, wlan1, wlan2 etc... Is there a way of making all future wifi devices use the same settings in /etc/network/interfaces instead of making a new section in interfaces every time a new adapter is plugged in?










share|improve this question





























    4















    I am working with a pcengines apu2c4 board with debian 8.4 installed.Obviously when you insert a wifi dongle new to the machine it is given wlan0, wlan1, wlan2 etc... Is there a way of making all future wifi devices use the same settings in /etc/network/interfaces instead of making a new section in interfaces every time a new adapter is plugged in?










    share|improve this question



























      4












      4








      4








      I am working with a pcengines apu2c4 board with debian 8.4 installed.Obviously when you insert a wifi dongle new to the machine it is given wlan0, wlan1, wlan2 etc... Is there a way of making all future wifi devices use the same settings in /etc/network/interfaces instead of making a new section in interfaces every time a new adapter is plugged in?










      share|improve this question
















      I am working with a pcengines apu2c4 board with debian 8.4 installed.Obviously when you insert a wifi dongle new to the machine it is given wlan0, wlan1, wlan2 etc... Is there a way of making all future wifi devices use the same settings in /etc/network/interfaces instead of making a new section in interfaces every time a new adapter is plugged in?







      debian usb network-interface bridge






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 at 21:27









      Rui F Ribeiro

      39.5k1479132




      39.5k1479132










      asked Apr 19 '16 at 10:27









      Simon DunningSimon Dunning

      5417




      5417






















          2 Answers
          2






          active

          oldest

          votes


















          3














          If you want to share the same IP config/network between several interfaces configure bridging.



          In Debian it should be something similar to this:



          allow-hotplug wlan0
          iface wlan0 inet manual

          allow-hotplug wlan1
          iface wlan1 inet manual

          auto br0
          iface br0 inet static
          bridge_ports wlan0 wlan1
          address 192.168.1.1
          netmask 255.255.255.0


          You also need to load the bonding kernel module.



          Add to /etc/modules



          bonding


          Please read: Network Card Bonding and Bridging On CentOS and Debian






          share|improve this answer

































            2














            You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.



            e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:



            # USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
            SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


            If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:



            SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"


            Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.



            I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.



            One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.



            Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.






            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',
              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%2f277498%2fhow-to-use-same-interfaces-settings-for-all-wlan-devices%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              If you want to share the same IP config/network between several interfaces configure bridging.



              In Debian it should be something similar to this:



              allow-hotplug wlan0
              iface wlan0 inet manual

              allow-hotplug wlan1
              iface wlan1 inet manual

              auto br0
              iface br0 inet static
              bridge_ports wlan0 wlan1
              address 192.168.1.1
              netmask 255.255.255.0


              You also need to load the bonding kernel module.



              Add to /etc/modules



              bonding


              Please read: Network Card Bonding and Bridging On CentOS and Debian






              share|improve this answer






























                3














                If you want to share the same IP config/network between several interfaces configure bridging.



                In Debian it should be something similar to this:



                allow-hotplug wlan0
                iface wlan0 inet manual

                allow-hotplug wlan1
                iface wlan1 inet manual

                auto br0
                iface br0 inet static
                bridge_ports wlan0 wlan1
                address 192.168.1.1
                netmask 255.255.255.0


                You also need to load the bonding kernel module.



                Add to /etc/modules



                bonding


                Please read: Network Card Bonding and Bridging On CentOS and Debian






                share|improve this answer




























                  3












                  3








                  3







                  If you want to share the same IP config/network between several interfaces configure bridging.



                  In Debian it should be something similar to this:



                  allow-hotplug wlan0
                  iface wlan0 inet manual

                  allow-hotplug wlan1
                  iface wlan1 inet manual

                  auto br0
                  iface br0 inet static
                  bridge_ports wlan0 wlan1
                  address 192.168.1.1
                  netmask 255.255.255.0


                  You also need to load the bonding kernel module.



                  Add to /etc/modules



                  bonding


                  Please read: Network Card Bonding and Bridging On CentOS and Debian






                  share|improve this answer















                  If you want to share the same IP config/network between several interfaces configure bridging.



                  In Debian it should be something similar to this:



                  allow-hotplug wlan0
                  iface wlan0 inet manual

                  allow-hotplug wlan1
                  iface wlan1 inet manual

                  auto br0
                  iface br0 inet static
                  bridge_ports wlan0 wlan1
                  address 192.168.1.1
                  netmask 255.255.255.0


                  You also need to load the bonding kernel module.



                  Add to /etc/modules



                  bonding


                  Please read: Network Card Bonding and Bridging On CentOS and Debian







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 19 '16 at 11:39

























                  answered Apr 19 '16 at 11:32









                  Rui F RibeiroRui F Ribeiro

                  39.5k1479132




                  39.5k1479132

























                      2














                      You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.



                      e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:



                      # USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
                      SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


                      If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:



                      SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"


                      Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.



                      I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.



                      One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.



                      Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.






                      share|improve this answer




























                        2














                        You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.



                        e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:



                        # USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
                        SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


                        If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:



                        SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"


                        Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.



                        I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.



                        One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.



                        Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.






                        share|improve this answer


























                          2












                          2








                          2







                          You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.



                          e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:



                          # USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
                          SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


                          If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:



                          SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"


                          Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.



                          I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.



                          One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.



                          Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.






                          share|improve this answer













                          You probably have to have an entry in /etc/udev/rules/70-persistent-net.rules that allocates the same wlan0 name to any wlan device that it detects.



                          e.g. On one of my systems, I have a TP-Link TL-WN721N that has the following rule:



                          # USB device 0x:0x (ath9k_htc) TP-Link TL-WN721N
                          SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


                          If I wanted to turn that into a generic rule that matched any WLAN device, regardless of the MAC address etc, I'd comment out or delete that rule and replace it with something like this:



                          SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan*", NAME="wlan0"


                          Note: This WILL cause you problems if you later find you need two wlan devices installed or otherwise need to distinguish between different wlan devices.



                          I just re-read your question. It seems like you might already have two wlan devices in the machine. I'm not sure if what you want is possible in that situation unless one of the devices is always the same (and has its own udev rule that comes before the generic rule) while the second device varies.



                          One possible method is to run something like sed -i -e '/wlan/d' /etc/udev/rules.d/70-persistent-net.rules on every reboot or from a root shell (and remember to make udev reload its config) before you swap the wlan usb adaptors. I know this works with eternet devices because I have to do something very similar whenever I replace a machine's motherboard or PCI-e ethernet card, or clone a system to new hardware.



                          Also Note: this works with a sysvinit debian system. I have no idea if it works the same on a systemd machine - the only systemd machine I have doesn't have a wlan interface, only ethernet. and I really don't feel like messing with it's network config right now, it was hard enough getting systemd to do what I wanted when I replaced its NIC (by replacing its motherboard) a few months ago.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 19 '16 at 12:10









                          cascas

                          38.7k453101




                          38.7k453101






























                              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%2f277498%2fhow-to-use-same-interfaces-settings-for-all-wlan-devices%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

                              Morgemoulin

                              Scott Moir

                              Souastre