VLAN Technology: XEN creates an Intranet

Source: Internet
Author: User

VLAN Technology: XEN creates an Intranet

 

Steps:

1. Create a Network

2. Create a VLAN

Several internal operations are involved when creating a VLAN.

● Create a Vlan object (① in the figure)

● Create a PIF (② in the figure) to connect the created VLAN (① in the figure) to the created Network (step 1)

● Vlan (① in the figure) and PIF (③ in the figure) are connected

Note:

1. A tag is a unique identifier of a VLAN (under the same PIF) in the range of 0-4096. That is to say, only 4096 + 1 VLAN can be created under a PIF.

2. A Network can only be associated with a PIF, just as a VDI can only be associated with a VBD, therefore, when a Network is associated with a PIF, it cannot be associated with another PIF (where X is shown in the figure)

Code:

 
 
  1. Network. Record networkRecord = new Network. Record ();
  2. NetworkRecord. nameLabel = "for_vlan_test_1 ";
  3. NetworkRecord. nameDescription = "for_vlan_test_1 ";
  4. NetworkRecord. MTU = 1500L; // maximum transmission unit, take the configuration file constant, 1500L
  5. NetworkRecord. otherConfig = null;
  6. Network network = Network. create (connection, networkRecord );
  7.  
  8. Long tag = 801L;
  9. PIF taggedPIF = PIF. getByUuid (connection, "8a6dfb4d-187f-a5d0-7e35-bd8d81a301a7"); // PIF indicates ③
  10. // Create vlan
  11. VLAN vlan = VLAN. create (connection, taggedPIF, tag, network );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.