System Administration Guide: Network Interfaces and Network Virtualization

Configuring a Basic Virtual Network

This section contains tasks for configuring a basic virtual network. For a topology diagram of a virtual network, see Figure 10–1. Use the following tasks to build the virtual network.


Tip –

The steps in all tasks in this chapter use the vi text editor in a terminal window. Alternatively, you can use the text editor of your choice.


ProcedureHow to Create a Virtual Network Interface

This procedure shows how to create a virtual network interface card (VNIC). VNICs are pseudo-interfaces upon which to build the containers of the virtual network. The resulting VNIC has an automatically generated MAC address. Depending on the network interface in use, you can instead explicitly assign a MAC address to a VNIC, as described in the dladm(1M).

When you first log in to a system, you are automatically in its global zone, which is where you configure VNICs. You can use VNICs in the global zone or as the building blocks for a particular type of non-global zone, the exclusive IP zone. For an introduction to zones, refer to Zones Overview in System Administration Guide: Virtualization Using the Solaris Operating System.

  1. Become superuser or assume the equivalent root role.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. View information about the system's available physical interfaces.


    # dladm show-phys
    LINK         MEDIA                STATE      SPEED DUPLEX   DEVICE
    e1000g2      Ethernet             unknown    0    half      e1000g2
    e1000g0      Ethernet             up         1000 full      e1000g0

    Currently the system has two installed interfaces, e1000g0 and e1000g2.

  3. Check the status of the data links on the system.


    # dladm show-link
    LINK        CLASS    MTU    STATE    OVER
    e1000g2     phys     1500   unknown  --
    e1000g0     phys     1500   up       --

    Only the e1000g0 data link is running over that interface and is configured “UP”.

    Unless you create customized names for your data links, the data link has the same name as the network interface device name that is displayed by dladm show-phys. For example, network interface e1000g0 has the data link name e1000g0 until you customize it. For more information on customized data link names, refer to Data Link and IP Interface Configuration (Tasks).

  4. Check the status of any interfaces on the IP layer.


    # ifconfig -a
    lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
             inet 127.0.0.1 netmask ff000000
    e1000g0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
            inet 192.168.3.70 netmask ffffff00 broadcast 192.168.3.255
            ether 0:14:4f:94:d0:40

    The output indicates that interface e1000g0 has the IP address 192.168.3.70. Therefore, the system is connected to the 192.168.3.0/24 network. e1000g0 has the MAC address 0:14:4f:94:d0:40.

  5. Create a VNIC in the system's global zone.


    # dladm create-vnic -l data-link vnic-name
    
    • data-link is the name of the interface where the VNIC is to be configured.

    • vnic-name is the name that you want to give the VNIC.

    For example, to create a VNIC named vnic0 on interface e1000g0, you would type the following:


    # dladm create-vnic -l e1000g0 vnic0
    

    Repeat this step for all planned VNICs in the virtual network.

  6. Plumb the VNIC and assign it an IP address.

    All VNICs must be configured and plumbed on the IP level. VNICs that are used in conjunction with an exclusive IP zone can be plumbed as part of the initial zone configuration or manually, using the steps in How to Manually Configure the VNIC and Exclusive IP Zone.

    For VNICs to be configured in the global zone, do the following:

    1. Use the ifconfig command as shown to configure the interface.


      # ifconfig vnic-name plumb
      # ifconfig vnic-name IP-address
      # ifconfig vnic-name  up
      

      For example, you would configure and plumb vnic0 over interface e1000g0as follows:


      # ifconfig vnic0 plumb
      # ifconfig vnic0 192.168.3.250
      # ifconfig vnic0 up
      
    2. Verify that the VNIC is configured and plumbed.


      # ifconfig -a
      

      Your output should resemble the following:


      lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> 
              mtu 8232 index 1
              inet 127.0.0.1 netmask ff000000
      e1000g0:flags=201100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4,CoS>
              mtu 1500 index 2
              inet 192.168.3.70 netmask ffffff00 broadcast 192.168.3.255
              ether 0:14:4f:94:d0:40
      vnic0: flags=201100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4,CoS> 
              mtu 9000 index 5
              inet 192.168.3.250 netmask ffffff00 broadcast 192.168.0.255
              ether 2:8:20:c2:39:38

      Look for the VNIC that you just configured in the ifconfig output. For example, vnic0 is in the previous output. The IP address that you specified and the ifconfig “UP” flag in the output must also be present. These items indicate that the VNIC is correctly configured and plumbed.

  7. Ensure that the VNIC configuration persists across reboots

    Create the file /etc/hostname.vnic-name.

    • In the global zone, do the following:


      # cd /etc
      # vi hostname.vnic-name
      IP address of vnic-name
      

      For example, you type the following:


      # cd /etc
      # vi hostname.vnic0
      192.168.3.250
      
    • Update the /etc/inet/hosts file with entries for all the VNICs you have created.

      The entries in the file should have the following format:


      vnic-IP-address      zoneID-vnic-IP-address
      

      For example, you might create the following entries:


      192.168.3.250      zone0-192-168-3-250

      Note –

      When creating the zone alias entry, be sure to put a dash after the zoneID. Additionally, substitute dashes for the dot delimeters in the IP address, as shown previously.


    • For exclusive IP zones, refer to the instructions in How to Verify the Exclusive IP Zone Over VNIC Configuration

  8. Verify that the new VNIC is created.


    # dladm show-vnic
    LINK       SPEED  MACADDRESS         MACADDRTYPE
    vnic0      0 Mbps  2:8:20:c2:39:38    random

Example 11–1 Creating Virtual Network Interfaces (VNIC)

This example contains the commands to use to create and verify three VNICs. One VNIC is used in the global zone. Two other VNICs are used with the exclusive IP zones in the upcoming tasks. This example illustrates the steps in Configuring a Basic Virtual Network to accomplish the following:


# dladm show-phys
LINK         MEDIA                STATE      SPEED DUPLEX   DEVICE
e1000g2      n                    unknown    0    half      e1000g2
e1000g0      Ethernet             up         1000 full      e1000g0
# dladm show-link
LINK        CLASS    MTU    STATE    OVER
e1000g2     phys     1500   unknown  --
e1000g0     phys     1500   up       --
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
         inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
        inet 192.168.3.70 netmask ffffff00 broadcast 192.168.3.255
        ether 0:14:4f:94:d0:40

# dladm create-vnic -l e1000g0 vnic0
# dladm create-vnic -l e1000g0 vnic1
# dladm create-vnic -l e1000g0 vnic2
# dladm show-vnic

LINK        OVER             SPEED  MACADDRESS         MACADDRTYPE
vnic0       e1000g0      1000 Mbps  2:8:20:c2:39:38    random
vnic1       e1000g0      1000 Mbps  2:8:20:5f:84:ff    random
vnic2       e1000g0      1000 Mbps  2:8:20:54:f4:74    random

# ifconfig vnic0 plumb
# ifconfig vnic0 192.168.3.250
# ifconfig vnic0 up

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:flags=201100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4,CoS>mtu 1500 index 2
        inet 192.168.3.70 netmask ffffff00 broadcast 192.168.3.255
        ether 0:14:4f:94:d0:40
vnic0: flags=201100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4,CoS> mtu 9000 index 5
        inet 192.168.3.250 netmask ffffff00 broadcast 192.168.0.255
        ether 2:8:20:c2:39:38

# vi /etc/hostname.vnic0
192.168.3.250
# vi /etc/inet/hosts
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.3.70    myhost     loghost
192.168.3.250      zone0-192-168-3-250

Next Steps

ProcedureHow to Create an Exclusive IP Zone Over a VNIC

The following task explains how to create two exclusive IP zones for a virtual network. If you want to use zones as the containers for the virtual network, always use exclusive IP zones. You cannot create non–global shared IP zones over VNICs in a virtual network scenario.

As an alternative, you can useSun xVM domains as the containers in the virtual network. For information about configuring Sun xVM Server and its domains, refer to theSun xVM Server Information Wiki.

Before You Begin

This procedure assumes that you have already configured at least two VNICs over a data link, as shown in Example 11–1. The VNICs are named vnic0, vnic1, and vnic2.

  1. On the system where you create the virtual network, become superuser or assume the equivalent root role.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. View the state of the VNICs on the system.


    # dladm show-vnic
    
    LINK        OVER             SPEED  MACADDRESS         MACADDRTYPE
    vnic1       e1000g0      1000 Mbps  2:8:20:5f:84:ff    random
    vnic2       e1000g0      1000 Mbps  2:8:20:54:f4:74    random

    The output indicates that vnic1 and vnic2 are currently configured over interface e1000g0.

  3. Begin the creation process for the exclusive IP zone by running the zonecfg interactive utility.


    Tip –

    Alternatively, you can run zonecfg as a command with appropriate subcommands and options to create the zone. For more information, refer to How to Configure the Zone in System Administration Guide: Virtualization Using the Solaris Operating System and the zonecfg(1M) man page.



    # zonecfg -z zoneID
    

    where ID represents the number to identify the zone. For example, the following command creates “zone1.”


    # zonecfg -z zone1
    

    The zonecfg program runs and prompts for information about the new zone.


    zonecfg:zone1>
  4. Start zone creation through the zonecfg interactive utility.


    zonecfg:zone1> create
    

    The remaining steps show how to create the exclusive IP zone and set other parameters. For a detailed description of parameters available for the zone, see How to Configure the Zone in System Administration Guide: Virtualization Using the Solaris Operating System.

  5. Create the zone path by setting a home directory for the zone, and then enable automatic booting.


    zonecfg:zone1> set zonepath=zone-home-directory
    zonecfg:zone1> set autoboot=true
    

    For example, zone-home-directory might be /export/home/zone1.

    The global zone will include home directories for all zones that you create through zonecfg. Thus, the /export/home directory in the global zone must contain an entry for zone1.

  6. Create the zone as exclusive IP.


    zonecfg:zone1> set ip-type=exclusive
    
  7. Create the network interface for the zone.


    zonecfg:zone1> add net
    

    This response starts the network configuration subprogram of zonecfg.

  8. Set the previously configured VNIC as the interface for the zone.


    zonecfg:zone1:net> set physical=vnic-data-link
    

    For example, you create vnic1 for zone1 as follows:


    zonecfg:zone1:net> set physical=vnic1
    

    Note –

    Although zonecfg has many options for describing a network interface, only use the set-physical parameter of add net for an IP exclusive zone.


  9. Complete zone configuration and verify the results.


    zonecfg:zone1:net> end
    zonecfg:zone1> verify
    

    The verify command checks for any configuration errors. If you have received errors, fix the configuration. If verify does not respond, assume the configuration is correct and continue.

  10. View information about the zone you just created.

    Use the info directive, as shown below:


    zonecfg:zone1> info
    zonename: zone1
    zonepath: /export/home/zone1
    brand: native
    autoboot: true
    .
    .
    net:
            address not specified
            physical: vnic1

    The message “address not specified” verifies that you have not specified an IP address for the zone. You create IP addresses for the zone's VNIC outside the zonecfg utility, as described in the upcoming procedure How to Configure an Exclusive IP Zone Over a VNIC Through the Zone Console.

    If info displays other incorrect information, you can modify the parameters, as explained in Using the zonecfg Command to Modify a Zone Configuration in System Administration Guide: Virtualization Using the Solaris Operating System. If the information is correct, continue to the next step.

  11. Commit the zone and close zonecfg.


    zonecfg:zone1> commit
    zonecfg:zone1> exit
    

    Be sure to commit the zone before exiting zonecfg.

  12. Create more zones, as needed, by following Steps 3 through 11.


Example 11–2 Creating an Exclusive IP Zone Over a VNIC

The following example contains the commands for creating a zone using the zonecfg utility. When the example is complete, the result is a zone called zone1 that is configured on vnic1. This example assumes that the VNIC is already created, as shown in Example 11–1. You can use this example for configuring as many exclusive IP zones over VNICs as you need for your virtual network. For an illustration of a basic virtual network, refer to Figure 10–1.

You must log in to the global zone of the system as superuser or equivalent role to run the next commands.


# dladm show-vnic

LINK        OVER             SPEED  MACADDRESS         MACADDRTYPE
vnic1       e1000g0      1000 Mbps  2:8:20:5f:84:ff    random
vnic2       e1000g0      1000 Mbps  2:8:20:54:f4:74    random

# zonecfg -z zone1

zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/home/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> set ip-type=exclusive
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=vnic1
zonecfg:zone1:net> end
zonecfg:zone1> verify

zonecfg:zone1> info
zonename: zone1
zonepath: /export/home/zone1
brand: native
autoboot: true
.
.
net:
        address not specified
        physical: vnic1

zonecfg:zone1> commit
zonecfg:zone1> exit

Next Steps

ProcedureHow to Install the Exclusive IP Zone on a VNIC

Before You Begin

This procedure assumes that you have completed VNIC creation, as described in How to Create a Virtual Network Interface. You also must have created and committed an exclusive IP zone, as described in How to Create an Exclusive IP Zone Over a VNIC.

In this procedure you install the newly created zone1 over vnic1.

  1. On the system where you create the virtual network, become superuser or assume the equivalent root role.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.


    Note –

    When you first log in to a system, you are automatically in its global zone. For an introduction to zones, refer to Zones Overview in System Administration Guide: Virtualization Using the Solaris Operating System.


  2. Verify that the new zone exists.


    # zoneadm -z zoneID verify
    

    The zoneadm command displays output similar to the following for a zone that is not yet installed:


    WARNING: /export/home/zone1 does not exist, so it could not be verified.
    When 'zoneadm install' is run, 'install' will try to create
    /export/home/zone1, and 'verify' will be tried again,
    but the 'verify' may fail if:
    the parent directory of /export/home/zone1 is group- or other-writable
    or
    /export/home/zone1 overlaps with any other installed zones.

    This message indicates that zone is ready to be installed.

  3. Install the new zone.

    Use the following syntax:


    # zoneadm -z zoneID install
    

    For example, you would type:


    # zoneadm -z zone1 install
    Preparing to install zone <zone1>
    Creating list of files to copy from the global zone.
    .
    .
    
    Zone <zone1> is initialized.
  4. Verify that the zone is installed.


    zoneadm list -iv
     
    

    You receive output similar to the following:


     ID NAME              STATUS     PATH                           BRAND    IP
       0 global           running    /                              native   shared
       - zone1            installed  /export/home/zone1             native   excl

    The output indicates that the exclusive IP zone is installed but not yet running.

  5. Boot the zone and then observe its new status.


    # zoneadm -z zone1 boot
    # zoneadm list -v
      ID NAME             STATUS     PATH                           BRAND    IP
       0 global           running    /                              native   shared
       1 zone1            running    /export/home/zone1             native   excl

    Note that zone1 has changed its state to running.

  6. Repeat this procedure for all exclusive IP zones in your virtual network.


Example 11–3 Installing and Booting an Exclusive IP Zone Over a VNIC

The following example contains the zoneadm and zlogin -C commands for installing the exclusive IP zone zone1 that is configured over vnic1. This example assumes that both the VNIC and zone are created, as shown in Example 11–2. You can use this example for installing every exclusive IP zone over a VNIC for your virtual network. For an illustration of a basic virtual network, refer to Figure 10–1.

You must log in to the global zone of the system as superuser or equivalent role to run the next commands.


# zoneadm -z zone1 verify
WARNING: /export/home/zone1 does not exist, so it could not be verified.
When 'zoneadm install' is run, 'install' will try to create
/export/home/zone1, and 'verify' will be tried again,
but the 'verify' may fail if:
the parent directory of /export/home/zone1 is group- or other-writable
or
/export/home/zone1 overlaps with any other installed zones.

# zoneadm -z zone1 install
Preparing to install zone <zone1>.
Creating list of files to copy from the global zone.
.
.
Zone <zone1> is initialized. 

zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - zone1            installed  /export/home/zone1             native   excl
  

# zoneadm -z zone1 boot
# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 zone1            running    /export/home/zone1             native   excl
   

Next Steps

After booting the zone, you need to perform initial configuration steps for the exclusive IP zone over a VNIC. Use one of the following methods to complete zone configuration:

ProcedureHow to Configure an Exclusive IP Zone Over a VNIC Through the Zone Console

After you have installed and booted all zones for the virtual network, your final step is to configure the zones.

Before You Begin

You must have created, installed, and booted exclusive IP zones over VNICs, as explained in the following procedures:

  1. On the system where you create the virtual network, become superuser or assume the equivalent root role.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. Log in to the console of a zone

    Begin initial zone configuration through the zone console.


    # zlogin -C zone-name
    

    where zone-name represents the name of the zone that you want to configure. For example, to log in to the console for zone1, type the following:


    # zlogin -C zone1
    

    Depending on your system, you might receive prompts from the console to set language preference and other parameters. Answer these prompts and continue.

  3. Select a terminal type.

    The zone configuration program offers choices such as the following


    What type of terminal are you using?
          1) ANSI Standard CRT
          2) DEC VT52
    .
    .
          8) Sun Workstation
          9) Televideo 910
          10) Televideo 925
          11) Wyse Model 50
          12) X Terminal Emulator (xterms)

    Type the number for the console terminal type for your system, for example 12 for an X terminal window.

  4. Confirm or change the information displayed by the zone configuration program.

    You receive a series of prompts for information about the new zone. Most of the responses are automatically generated. If the information is incorrect, you can press F4 and supply the correct information. Otherwise, press F2 to accept and continue to the next parameter.

    The information that you need to supply or verify includes:

    • IP address for the zone. Each exclusive IP zone and its corresponding VNIC must have a unique IP address. You can use a DHCP address or a static IP address.

    • Host name. Enter the host name for the zone, for example, zone1.

    • Whether the system with the virtual network is part of a subnet.

    • Netmask of the IP address.

    • Default route. You can use the IP address of the interface on which the virtual network is built.

    • IP address of a router on the system's network

    When you are finished configuring the zone, the system reboots. After the reboot, the zone is ready for use.

  5. Repeat the initial configuration steps for all zones in the virtual network.


Example 11–4 Final Configuration of an Exclusive IP Zone Over a VNIC

This example shows a typical zone configuration session using the zone console configuration program.


# zlogin -C zone1
What type of terminal are you using?
.
.
.
8) Sun Workstation
9) Televideo 910
10) Televideo 925
11) Wyse Model 50
12) X Terminal Emulator (xterms)
13) CDE Terminal Emulator (dtterm)
14) Other
Type the number of your choice and press Return: 13
.
.
IP address for zone1: 192.168.3.20
.
Confirm the following information. If it is correct, press F2;
to change any information, press F4.

Hostname: zone1
IP address: 192.168.3.20
System part of a subnet: Yes
Netmask: 255.255.255.0
Enable IPv6: No
Default route: 192.168.3.70
Router IP address: 192.168.3.25

System reboots.


Next Steps

Verify that zone configuration is correct, as explained in How to Verify the Exclusive IP Zone Over VNIC Configuration.

ProcedureHow to Manually Configure the VNIC and Exclusive IP Zone

This procedure explains how to manually configure IP addresses for VNICs and their associated zones. If you configured zones through the zone console after the initial booting, these addresses are configured automatically. You need to follow the next steps only if one of the following conditions is true:

Before You Begin

The procedure assumes that both the VNIC and zone are created, installed, and booted in the global zone.

  1. On the system where you create the virtual network, become superuser or assume the equivalent root role.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. Log in to the zone.

    For example, you would type:


    # zlogin zone1
    # pwd
    /
  3. Verify that the VNIC is configured.


    # ifconfig -a
    lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    	     inet 127.0.0.1 netmask ff000000
    lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
         inet6 ::1/128

    In this output, only the IPv4 and IPv6 loopback addresses are plumbed and up. No entry exists for the VNIC.

  4. Manually configure and plumb the VNIC from within the exclusive IP zone.

    You must plumb a VNIC in the following order for it to function properly in the virtual network.


    # ifconfig vnic-data-link plumb
    # ifconfig vnic-data-link IP-address
    # ifconfig vnic-data-link up
    

    For example, to add IP address 192.168.3.20 to vnic1, do the following:


    # ifconfig vnic1 plumb
    # ifconfig vnic1 192.168.3.20
    # ifconfig vnic1 up
    
  5. Verify that the VNIC is now configured and plumbed.


    # ifconfig -a
    lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    	     inet 127.0.0.1 netmask ff000000
    vnic1: flags=201000842<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
               inet 192.168.3.20 netmask ffffff00 broadcast 192.168.3.255
               ether 2:8:20:54:f4:74
  6. Exit the exclusive IP zone, and go to the zone's subdirectory tree in the global zone.


    # exit
    # cd /export/home/zone1
    
  7. Create a hostname.vnic–name file for the VNIC.


    # cd root/etc
    # vi hostname.vnic1
    zoneID-IP address
    

    For example, for zone1 you type:


    zone1-192.183.3.20
  8. Add an entry for the zone in the root/etc/inet/hosts file.


    # cd inet
    # vi hosts
    # Internet host table
    #
    ::1                  localhost
    127.0.0.1            localhost
    192.168.3.20  zone1  loghost
    
  9. If the entry does not already exist, add the VNIC and its zone to the global zone's /etc/inet/hosts file.


    # cd /etc/inet
    # vi hosts
    # Internet host table
    #
    ::1     localhost
    127.0.0.1         localhost
    192.168.3.70      myhost     loghost
    192.168.3.20      zone1-192-168-3-20
    

Example 11–5 Manually Configuring a VNIC and Exclusive IP Zone

This example illustrates the following procedures:

You must log in to the global zone of the system as superuser or equivalent role to run the next commands.


# zlogin zone1
/
# ifconfig vnic1 plumb
# ifconfig vnic1 192.168.3.20
# ifconfig vnic1 up
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
	     inet 127.0.0.1 netmask ff000000
vnic1: flags=201000842<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
           inet 192.168.3.20 netmask ffffff00 broadcast 192.168.3.255
           ether 2:8:20:54:f4:74
# exit
# cd /export/home
# cd zone1/root/etc
# vi hostname.vnic1
zone1-192.168.3.20

# vi inet/hosts
# Internet host table
#
::1                  localhost
127.0.0.1            localhost
192.168.3.20  zone1  loghost

# cd /etc/inet
# vi hosts
# Internet host table
#
::1     localhost
127.0.0.1         localhost
192.168.3.70      myhost     loghost
192.168.3.20      zone1-192-168-3-20

Next Steps

After you are finished, verify that your configuration is correct, as explained in How to Verify the Exclusive IP Zone Over VNIC Configuration.

ProcedureHow to Verify the Exclusive IP Zone Over VNIC Configuration

After you complete zone configuration, confirm that the zones and VNICs are now configured as you expected.

Before You Begin

The procedures in this task assume that you have installed and configured two or more exclusive IP zones over a VNIC. If you have not done this, perform the following procedures, in sequential order:

  1. On the system where you build the virtual network, become superuser or assume the equivalent root role in the global zone.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. Go to the parent directory for all zones that you created.

    You supply this directory to the zonecfg command as the first part of the zone path.


    # cd parent-zone-path
    

    For example, to access the parent directory for both zones created in the procedure How to Create an Exclusive IP Zone Over a VNIC, type:


    # cd /export/home
    

    If the parent directory for the zones does not exist, check your zone configuration.

  3. Verify that the zone home directory trees exist in the correct parent directory in the global zone.


    # pwd
    /export/home
    # ls
    zone-name
    

    For example, to verify that the zone subdirectories have been created in the parent /export/home directory, in the global zone, type:


    # ls
    zone1 zone2

    The subdirectories for the two new zones have been created. If these subdirectories do not exist, check your zone configuration.

  4. Verify that the hostname.vnic-name file exists and that its entry is correct.

    Each VNIC that you configure for a zone requires a hostname.vnic-name file to ensure that the IP address of the VNIC and zone persist after reboots. First, verify that a hostname.vnic-name file exists:


    cd /export/home/zone-name/root/etc
    # ls host*
     hostname.vnic1  hosts

    This output indicates that a hostname.vnic1 file exists. The file should contain one entry with the name of the zone, for example:


    cat hostname.vnic1
    zone1

    If this file does not exist, create it as shown in How to Manually Configure the VNIC and Exclusive IP Zone.

  5. Check the contents of the zone's hosts file.


    # pwd
    /export/home/zone-name/root/etc/
    # cat hosts
    # Internet host table
    #
    ::1                  localhost
    127.0.0.1            localhost
    192.168.3.20  zone1  loghost

    In this output, the entry 192.168.3.20 zone1 loghost shows the address that is assigned to the VNIC for zone1. Your output should have a similar entry for the zone and VNIC.

    If this file does not have an entry for the zone, refer to the appropriate step in How to Manually Configure the VNIC and Exclusive IP Zone.

  6. Add the IP addresses of the VNICs and names of their associated zones to the /etc/inet/hosts file in the global zone.


    Note –

    Be sure that you are in the hosts file for the global zone, not the host file in a subdirectory tree for a zone.



    # cd /etc/inet
    # vi hosts
    # Internet host table
    #
    ::1     localhost
    127.0.0.1       localhost
    192.168.3.70    myhost     loghost

    The only non-loopback IP address in this output is 192.168.3.70, the address associated with the system's network interface. Add entries for all VNICs associated with zones to this file, using the following format:


    VNIC-IP-address        zone-name- IP address
    

    For example, you would type the following entry for vnic1 and zone1:


    192.168.3.20    zone1-192-168-3-20
  7. Log in to the new zone and verify that you are in its home directory:

    For example, for zone1 you would type:


    # zlogin zone1
    # pwd
    /

    You are now in the root directory of zone1. If you cannot log in to the zone, check your zone configuration.

  8. Verify that the VNIC you previously defined for the zone is now configured as an IP interface.

    Your output should resemble the following:


    # ifconfig -a
    lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    	     inet 127.0.0.1 netmask ff000000
    vnic1: flags=201000842<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
               inet 192.168.3.20 netmask ffffff00 broadcast 192.168.3.255
               ether 2:8:20:54:f4:74

    In the output, vnic1 is configured with the IP address that you specified during zone configuration. vnic1 also has an automatically generated unique MAC address ether 2:8:20:54:f4:74 . Note that there are no entries for the system's network interfaces or for VNICs that are configured for other zones.

    If you do not have an entry for the VNIC associated with the zone, you need to plumb the VNIC. In particular, you will have these results if you chose not to perform initial VNIC configuration from the zone console. For instructions for plumbing the VNIC, refer to the appropriate step in How to Manually Configure the VNIC and Exclusive IP Zone.

  9. Exit the current zone.

    Return to the global zone, where you can repeat the previous steps to confirm that all VNICs and zones are properly configured.

Next Steps

You can use various tools to observe network traffic and take statistics on zone usage.

If you need to disassemble the virtual network, refer to How to Remove the Virtual Network Without Removing the Zones.

Complete Example for Creating a Virtual Network

This section contains a complete set of commands for configuring a virtual network.


Example 11–6 Basic Virtual Network

This example shows how to implement the virtual network scenario shown in Figure 10–1. The example elaborates on the tasks presented in Configuring a Basic Virtual Network. The commands do the following:


# dladm show-phys
# dladm show-link
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
         inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
        inet 192.168.3.70 netmask ffffff00 broadcast 192.168.3.255
        ether 0:14:4f:94:d0:40

# dladm create-vnic -l e1000g0 vnic1
# dladm create-vnic -l e1000g0 vnic2
# dladm show-vnic
LINK        OVER             SPEED  MACADDRESS         MACADDRTYPE
vnic1       e1000g0      1000 Mbps  2:8:20:5f:84:ff    random
vnic2       e1000g0      1000 Mbps  2:8:20:54:f4:74    random

# zonecfg -z zone1
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/home/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> set ip-type=exclusive
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=vnic1
zonecfg:zone1:net> end
zonecfg:zone1> verify

zonecfg:zone1> info
zonename: zone1
zonepath: /export/home/zone1
brand: native
autoboot: true
.
.
net:
        address not specified
        physical: vnic1

zonecfg:zone1> commit
zonecfg:zone1> exit

# zoneadm -z zone1 verify
WARNING: /export/home/zone1 does not exist, so it could not be verified.
When 'zoneadm install' is run, 'install' will try to create
/export/home/zone1, and 'verify' will be tried again,
but the 'verify' may fail if:
the parent directory of /export/home/zone1 is group- or other-writable
or
/export/home/zone1 overlaps with any other installed zones.

# zoneadm -z zone1 install
Preparing to install zone <zone1>.
Creating list of files to copy from the global zone.
.
.
Zone <zone1> is initialized. 


zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - zone1            installed  /export/home/zone1             native   excl

# zoneadm -z zone1 boot

# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 zone1            running    /export/home/zone1             native   excl

# zlogin zone1
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
 inet6 ::1/128

# ifconfig vnic1 plumb
# ifconfig vnic1 192.168.3.20
# ifconfig vnic1 up

# ifconfig -a
.
vnic1: flags=201000842<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
        inet 192.168.3.20 netmask ffffff00 broadcast 192.168.3.255
        ether 2:8:20:54:f4:74

# pwd
vnic1/
# cd root/etc
# vi hostname.vnic1
zone1-192.183.3.20

# vi /etc/inet/hosts
# Internet host table
#
::1     localhost
127.0.0.1         localhost
192.168.3.70      myhost     loghost
192.168.3.20      zone1-192-168-3-20

After you repeat the same steps to create zone2 and to assign vnic2 to zone2, the following example shows you how to verify that the two zones are properly configured with their respective VNICs.


# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 zone1            running    /export/home/zone1             native   excl
   2 zone2            running    /export/home/zone2             native   excl

# vi /etc/inet/hosts
# Internet host table
#
::1     localhost
127.0.0.1         localhost
192.168.3.70      myhost     loghost
192.168.3.20      zone1-192-168-3-20
192.168.3.22      zone2-192-168-3-22

ProcedureHow to Remove the Virtual Network Without Removing the Zones

The following procedure shows how to take down a virtual network while leaving its zones intact. The instructions refer to the virtual network that is configured in Configuring a Basic Virtual Network.

Use this procedure if you must do any of the following:

Before You Begin

This task assumes that you have a running virtual network that consists of exclusive IP zones.

  1. On the system with the virtual network, become superuser or assume the equivalent root role in the global zone.

    To create and assign the root role, see How to Make root User Into a Role in System Administration Guide: Security Services.

  2. Verify the state of the currently configured zones.


    # zoneadm list -v
    

    For example, you receive output similar to the following:


    ID  NAME     STATUS       PATH                           BRAND            IP
     0  global   running      /                              native           shared
     1  zone1    running      /export/home/zone1             native           excl 
     2  zone2    running      /export/home/zone2             native           excl
  3. Halt the exclusive IP zones of the virtual network.

    Issue the following command separately for each zone to be halted.


    # zoneadm -z zone-name halt
    

    Replace zone-name with the name of each zone.

    When you halt the zone, you remove the zone's application environment and terminate a number of system activities, as explained in Halting a Zone in System Administration Guide: Virtualization Using the Solaris Operating System.

  4. Verify that the zones have been halted.


    # zoneadm list -iv
    

    You receive output similar to the following:


    ID NAME             STATUS     PATH                           BRAND    IP
       0 global           running    /                              native   shared
       - zone1            installed  /export/home/zone1             native   excl
       - zone2            installed  /export/home/zone2             native   excl

    Note that the zones are no longer running, although they remain installed. To reboot a halted zone, refer to How to Boot a Zone in System Administration Guide: Virtualization Using the Solaris Operating System.

  5. Review the state of the VNICs that were configured for the halted zones.


    # dladm show-vnic
    

    You receive output similar to the following:


    LINK        OVER             SPEED  MACADDRESS         MACADDRTYPE
    vnic1       e1000g0      1000 Mbps  2:8:20:5f:84:ff    random
    vnic2       e1000g0      1000 Mbps  2:8:20:54:f4:74    random

    The resulting output shows that the VNICs are still configured as data links in the global zone. These VNICs were only plumbed and up in their associated exclusive IP zones, which are now halted. These VNICs are not plumbed in the global zones.

  6. Delete the VNICs.


    # dladm delete-vnic vnic-link-name 
    

    For example, you would type the following to delete the VNICs in the zones in Figure 10–1.


    # dladm delete-vnic vnic1
    # dladm delete-vnic vnic1
    
Next Steps

You can perform further operations on the existing zones, as required.