Go to main content

Managing Network Datalinks in Oracle® Solaris 11.3

Exit Print View

Updated: December 2017
 
 

Configuring a VLAN

The following procedure describes how to create a VLAN over a datalink by using the dladm command. You can create an IP interface over a VLAN and configure the interface with an IP address by using the ipadm command. For information about the dladm and ipadm commands, see the dladm(1M) and ipadm(1M) man pages.

You can also configure a VNIC with a VLAN ID to host the VLAN traffic. For more information, see How to Configure VNICs as VLANs in Managing Network Virtualization and Network Resources in Oracle Solaris 11.3.

How to Configure a VLAN

Before You Begin

This procedure assumes that the zones are already created on the system. For information about zone configuration, refer to Chapter 1, How to Plan and Configure Non-Global Zones in Creating and Using Oracle Solaris Zones.

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.3.

  2. Determine the types of links that are in use on the system.
    # dladm show-link
  3. Create a VLAN link over a datalink.
    # dladm create-vlan -l link -v vid VLAN-link
    link

    Specifies the link on which the VLAN interface is being created.

    vid

    Indicates the VLAN ID number.

    VLAN-link

    Specifies the name of the VLAN, which can also be a meaningful custom name. For information about VLAN names, see Assigning VLAN Names.

  4. Verify the VLAN configuration.
    # dladm show-vlan
  5. Create an IP interface over the VLAN.
    # ipadm create-ip interface

    Where interface provides the VLAN name.

  6. Configure the IP interface with an IP address.
    # ipadm create-addr -a address interface
Example 14  Creating a VLAN

This example shows how to create the VLAN configuration that is illustrated in Local Area Network With Three VLANs.

  1. Check the available links and create the VLANs over the specific links.

    # dladm show-link
    LINK     CLASS     MTU     STATE     OVER
    net0     phys      1500    up        --         
    net1     phys      1500    up        --        
    net2     phys      1500    up        --
  2. Host A:

    # dladm create-vlan -l net0 -v 123 infotech0

    Host C:

    # dladm create-vlan -l net0 -v 123 infotech0

    Host F:

    # dladm create-vlan -l net0 -v 456 humres0

    Host B:

    # dladm create-vlan -l net0 -v 456 humres0

    Host D:

    # dladm create-vlan -l net0 -v 789 acctg0

    Host E:

    # dladm create-vlan -l net0 -v 789 acctg0
  3. Display the VLANs created.

    # dladm show-vlan
    
    LINK           VID   SVID    PVLAN-TYPE   FLAGS    OVER        
    infotech0      123    --       --         ----     net0  
    infotech0      123    --       --         ----     net0
    humres0        456    --       --         ----     net0
    humres0        456    --       --         ----     net0
    acctg0         789    --       --         ----     net0
    acctg0         789    --       --         ----     net0
    
Example 15  Configuring VLANs With Zone's anet Resource

This example shows configuring VLANs with zone's anet resource. This example assumes that you have already configured different zones in the system. For more information about configuring zones, see Creating and Using Oracle Solaris Zones.

  1. Assign the VLAN IDs 11 and 12 to ZoneA and ZoneB respectively.

    solaris#zonecfg -z ZoneA
          zonecfg:ZoneA> add anet
          zonecfg:ZoneA:anet> set linkname=net0
          zonecfg:ZoneA:anet> set lower-link=net0
          zonecfg:ZoneA:anet> set vlan-id=11
          zonecfg:ZoneA:anet> set allowed-address=192.0.2.10/24
          zonecfg:ZoneA:anet> set defrouter=192.0.2.1      
          zonecfg:ZoneA:net> end
    solaris#zonecfg -z ZoneB
          zonecfg:ZoneA> add anet
          zonecfg:ZoneA:anet> set linkname=net1
          zonecfg:ZoneA:anet> set lower-link=net1
          zonecfg:ZoneA:anet> set vlan-id=12
          zonecfg:ZoneA:anet> set allowed-address=192.0.2.20/24
          zonecfg:ZoneA:anet> set defrouter=192.0.2.21
          zonecfg:ZoneA:anet> end
  2. Display the VLAN IDs assigned to the zones.

    solaris:~# dladm show-vnic
    LINK            OVER           SPEED  MACADDRESS        MACADDRTYPE IDS
    ZoneA/anet      net0           1000   2:8:20:47:8c:85   random      VID:11
    ZoneB/anet      net1           1000   2:8:20:47:8c:85   random      VID:12

    Note -  Make sure that the VLANs are also configured on the switch.
Example 16  Configuring VLANs With Zones

This example shows how to create the VLAN configuration that is illustrated in VLANs With Zones. This example assumes that you have already configured different zones in the system. For more information about configuring zones, see Creating and Using Oracle Solaris Zones.

  1. Check the available links that can be used for configuring VLANs and then create the VLAN VNICs over the specific links.

    root@solaris# dladm show-link
    LINK     CLASS     MTU     STATE     OVER
    net0     phys      1500    up        --         
    net1     phys      1500    up        --       
    net2     phys      1500    up        --        
    
    root@solaris# dladm create-vnic -v 101 -l net0 vnic1
    root@solaris# dladm create-vnic -v 102 -l net0 vnic2
    root@solaris# dladm create-vnic -v 103 -l net0 vnic3
    root@solaris# dladm show-vnic
    LINK      OVER    SPEED   MACADDRESS         MACADDRTYPE   IDS
    vnic1     net0    1000    2:8:20:35:b:9a     random        VID:101      
    vnic2     net0    1000    2:8:20:fa:94:57    random        VID:102 
    vnic3     net0    1000    2:8:20:51:1c:4a    random        VID:103

    When link information is displayed, the VLANs are included in the list.

    root@solaris# dladm show-link
    LINK      CLASS    MTU      STATE     OVER
    net0      phys     1500     up        --
    vnic1     vnic     1500     up        net0
    vnic2     vnic     1500     up        net0
    vnic3     vnic     1500     up        net0
  2. Specify the VLAN IDs 101, 102, and 103 to ZoneA, ZoneB, and ZoneC respectively.

    root@solaris# zonecfg -z ZoneA 
    zonecfg:ZoneA> add net
    zonecfg:ZoneA:net> set physical=vnic1
    zonecfg:ZoneA:net> end
    zonecfg:ZoneA> verify
    zonecfg:ZoneA> commit
    zonecfg:ZoneA> exit
    root@solaris# zoneadm -z ZoneA reboot
      
    root@solaris# zonecfg -z ZoneB 
    zonecfg:ZoneB> add net
    zonecfg:ZoneB:net> set physical=vnic2
    zonecfg:ZoneB:net> end
    zonecfg:ZoneB> verify
    zonecfg:ZoneB> commit
    zonecfg:ZoneB> exit
    root@solaris# zoneadm -z ZoneB reboot
      
    root@solaris# zonecfg -z ZoneC 
    zonecfg:ZoneC> add net
    zonecfg:ZoneC:net> set physical=vnic3
    zonecfg:ZoneC:net> end
    zonecfg:ZonCe> verify
    zonecfg:ZoneC> commit
    zonecfg:ZoneC> exit
    root@solaris# zoneadm -z ZoneC reboot
  3. Display the VLAN VNICs assigned to the zones.

    root@solaris:~# dladm show-vnic
    LINK            OVER           SPEED  MACADDRESS        MACADDRTYPE IDS
    ZoneA/vnic1     net0           1000   2:8:20:47:8c:85   random      VID:101
    ZoneB/vnic2     net0           1000   2:8:20:47:8c:85   random      VID:102
    ZoneC/vnic3     net0           1000   2:8:20:47:8c:85   random      VID:103
      
  4. Log in to each non-global zone to configure the VLAN with an IP address.

    root@solaris:~# zlogin ZoneA
    root@ZoneA:~# ipadm create-ip vnic1
    root@ZoneA:~# ipadm create-addr -a 192.0.2.1 vnic1
    vnic1/v4
    root@solaris:~# zlogin ZoneB
    root@ZoneB:~# ipadm create-ip vnic2
    root@ZoneB:~# ipadm create-addr -a 192.0.2.5 vnic2
    vnic2/v4
    root@solaris:~# zlogin ZoneC
    root@ZoneC:~# ipadm create-ip vnic3
    root@ZoneC:~# ipadm create-addr -a 192.0.2.8 vnic3
    vnic3/v4

    Note -  Make sure that the VLANs are also configured on the switch.

    After all the VLANs have been configured with IP addresses, the configuration is complete. The three VLANs are operative and can host traffic for their respective zones.