Creating a VLAN












0














I want to connect three of my computers in a LAN as nodes in a single VLAN. How do I do it? I know I can create a VLAN using the




vconfig add [interface name] [vlan id]




command. But how do I connect the other computers to the same VLAN?
Is the VLAN id, a local reference in a particular computer or is it visible to all computers in the VLAN?










share|improve this question





























    0














    I want to connect three of my computers in a LAN as nodes in a single VLAN. How do I do it? I know I can create a VLAN using the




    vconfig add [interface name] [vlan id]




    command. But how do I connect the other computers to the same VLAN?
    Is the VLAN id, a local reference in a particular computer or is it visible to all computers in the VLAN?










    share|improve this question



























      0












      0








      0







      I want to connect three of my computers in a LAN as nodes in a single VLAN. How do I do it? I know I can create a VLAN using the




      vconfig add [interface name] [vlan id]




      command. But how do I connect the other computers to the same VLAN?
      Is the VLAN id, a local reference in a particular computer or is it visible to all computers in the VLAN?










      share|improve this question















      I want to connect three of my computers in a LAN as nodes in a single VLAN. How do I do it? I know I can create a VLAN using the




      vconfig add [interface name] [vlan id]




      command. But how do I connect the other computers to the same VLAN?
      Is the VLAN id, a local reference in a particular computer or is it visible to all computers in the VLAN?







      linux vlan






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Rui F Ribeiro

      39.3k1479131




      39.3k1479131










      asked Mar 6 '17 at 11:26









      aniztaraniztar

      135




      135






















          1 Answer
          1






          active

          oldest

          votes


















          3














          For physical servers, it is best to define a VLAN on your network / infra-structure.



          Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.



          For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).



          Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.



          Usually it only may make sense dealing with VLANs at Linux level when:



          1) your router is a linux box;

          2) you are in a test network.



          Nonetheless, if you still insist in creating a VLAN for testing, you have to:



          1) load the relevant kernel mode



          modprobe 8021q


          2) Add the interface to the required VLAN (5 for instance)



          vconfig add eth0 5


          You will have a result an interface called eth0.5.



          All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.



          Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.



          I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)



          Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.



          As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.



          Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.



          For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.



          In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.






          share|improve this answer























          • Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
            – aniztar
            Mar 6 '17 at 11:57










          • Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
            – Rui F Ribeiro
            Mar 6 '17 at 11:58











          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%2f349458%2fcreating-a-vlan%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









          3














          For physical servers, it is best to define a VLAN on your network / infra-structure.



          Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.



          For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).



          Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.



          Usually it only may make sense dealing with VLANs at Linux level when:



          1) your router is a linux box;

          2) you are in a test network.



          Nonetheless, if you still insist in creating a VLAN for testing, you have to:



          1) load the relevant kernel mode



          modprobe 8021q


          2) Add the interface to the required VLAN (5 for instance)



          vconfig add eth0 5


          You will have a result an interface called eth0.5.



          All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.



          Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.



          I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)



          Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.



          As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.



          Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.



          For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.



          In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.






          share|improve this answer























          • Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
            – aniztar
            Mar 6 '17 at 11:57










          • Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
            – Rui F Ribeiro
            Mar 6 '17 at 11:58
















          3














          For physical servers, it is best to define a VLAN on your network / infra-structure.



          Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.



          For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).



          Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.



          Usually it only may make sense dealing with VLANs at Linux level when:



          1) your router is a linux box;

          2) you are in a test network.



          Nonetheless, if you still insist in creating a VLAN for testing, you have to:



          1) load the relevant kernel mode



          modprobe 8021q


          2) Add the interface to the required VLAN (5 for instance)



          vconfig add eth0 5


          You will have a result an interface called eth0.5.



          All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.



          Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.



          I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)



          Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.



          As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.



          Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.



          For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.



          In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.






          share|improve this answer























          • Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
            – aniztar
            Mar 6 '17 at 11:57










          • Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
            – Rui F Ribeiro
            Mar 6 '17 at 11:58














          3












          3








          3






          For physical servers, it is best to define a VLAN on your network / infra-structure.



          Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.



          For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).



          Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.



          Usually it only may make sense dealing with VLANs at Linux level when:



          1) your router is a linux box;

          2) you are in a test network.



          Nonetheless, if you still insist in creating a VLAN for testing, you have to:



          1) load the relevant kernel mode



          modprobe 8021q


          2) Add the interface to the required VLAN (5 for instance)



          vconfig add eth0 5


          You will have a result an interface called eth0.5.



          All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.



          Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.



          I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)



          Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.



          As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.



          Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.



          For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.



          In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.






          share|improve this answer














          For physical servers, it is best to define a VLAN on your network / infra-structure.



          Furthermore if you define a VLAN at interface level on your servers they won't be able to talk with your router to leave that network as the router won't be part of that VLAN. That is as you are defining a Virtual LAN, only the elements that belong to that Virtual LAN are able to exchange data between them.



          For creating VLANs, the network infra-structure will have also to support VLANs (e.g. your switch). Some cheaper/domestic equipments do not support VAN tagging (802.1Q).



          Put simply, usually in a physical situation like yours, VLANs are defined at the switch level. Normally all the switch ports where the servers that take part of that VLAN are connected and their router (if not dealing with a switch layer 3 e.g. a switch router), are tagged with that VLAN.



          Usually it only may make sense dealing with VLANs at Linux level when:



          1) your router is a linux box;

          2) you are in a test network.



          Nonetheless, if you still insist in creating a VLAN for testing, you have to:



          1) load the relevant kernel mode



          modprobe 8021q


          2) Add the interface to the required VLAN (5 for instance)



          vconfig add eth0 5


          You will have a result an interface called eth0.5.



          All the servers that you want added to the same VLAN will have to be configured with the vlan id 5.



          Likewise, if you want groups of different VLANs, you will use different VLAN ids, and will group the servers that belong to that VLANs accordingly.



          I will leave here a link: HowTo: Configure Linux Virtual Local Area Network (VLAN)



          Please do note, for larger networks, separating networks into VLANs may require proper planning, and involve dynamic more complicated protocols, however that is out of the scope of this question and Unix&Linux.



          As yet another footnote, there are iOT devices and cheap router/switch/AP devices as thr TPLink and ASUS wifi APs with multiple ethernet ports that support cheap switch chipsets controlled from Linux.



          Normally that chipsets whilst they support some sort of VLAN functionality, they just do an internal form of VLAN (internal to the equipment/to the chipset), and do not support 802.1Q.



          For instance, in the Lamobo/Banana PI R1, such chipset is the BCM53125.



          In that case, all the switches would be created only at the Linux (router) switch level, and the other servers/switch/routers would known nothing about VLANs.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 1 '18 at 13:15

























          answered Mar 6 '17 at 11:34









          Rui F RibeiroRui F Ribeiro

          39.3k1479131




          39.3k1479131












          • Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
            – aniztar
            Mar 6 '17 at 11:57










          • Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
            – Rui F Ribeiro
            Mar 6 '17 at 11:58


















          • Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
            – aniztar
            Mar 6 '17 at 11:57










          • Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
            – Rui F Ribeiro
            Mar 6 '17 at 11:58
















          Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
          – aniztar
          Mar 6 '17 at 11:57




          Thank you for the reply. Like you said I am trying this as a test where I want to do this at linux level. I followed the link you posted. I created a VLAN device on eth0 interface on one machine and gave it the id 5. So running the similar command on other two machines with VLAN id 5 will bring them together in one VLAN?
          – aniztar
          Mar 6 '17 at 11:57












          Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
          – Rui F Ribeiro
          Mar 6 '17 at 11:58




          Yes, I was just adding that to the post when I saw your question. Will add a line more in a sec.
          – Rui F Ribeiro
          Mar 6 '17 at 11:58


















          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.





          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%2funix.stackexchange.com%2fquestions%2f349458%2fcreating-a-vlan%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 make a Squid Proxy server?

          第一次世界大戦

          Touch on Surface Book