How to use same interfaces settings for all wlan devices











up vote
4
down vote

favorite












I am working with a pcengines apu2c4 board with debian 8.4 installed.I am quite new to Linux.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




























    up vote
    4
    down vote

    favorite












    I am working with a pcengines apu2c4 board with debian 8.4 installed.I am quite new to Linux.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


























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I am working with a pcengines apu2c4 board with debian 8.4 installed.I am quite new to Linux.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.I am quite new to Linux.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 Nov 24 at 20:03









      Rui F Ribeiro

      38.3k1475126




      38.3k1475126










      asked Apr 19 '16 at 10:27









      Simon Dunning

      5417




      5417






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          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






























            up vote
            2
            down vote













            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',
              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








              up vote
              3
              down vote













              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



























                up vote
                3
                down vote













                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

























                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  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 Ribeiro

                  38.3k1475126




                  38.3k1475126
























                      up vote
                      2
                      down vote













                      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

























                        up vote
                        2
                        down vote













                        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























                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          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









                          cas

                          38.3k44898




                          38.3k44898






























                               

                              draft saved


                              draft discarded



















































                               


                              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

                              サソリ

                              広島県道265号伴広島線

                              Accessing regular linux commands in Huawei's Dopra Linux