System Administration Guide: Network Interfaces and Network Virtualization

Chapter 2 Configuring an IP Interface

This chapter provides the procedures that are used to configure a single data link and then an IP interface over that link.

About IP Interface Configuration

After you install the Solaris OS, you might perform the following tasks:

You use the appropriate dladm subcommands to administer data links such as assigning customized names to a link. For a description of link names, see Assigning Names to Data Links. If the data link is also intended to be used for IP communication, you then configure IP interfaces over the data link by using the ifconfig command.

Data Link and IP Interface Configuration (Tasks)

This section describes basic configuration procedures on a data link.

Table 2–1 Configuring Network Links (Task Map)

Task 

Description 

For Instructions 

Sets a system to support unique MAC addresses. 

Configures a SPARC based system to allow unique MAC addresses for interfaces. 

SPARC: How to Ensure That the MAC Address of an Interface Is Unique

Configure an IP interface over a data link. 

Performs basic IP interface configuration. 

How to Configure an IP Interface After System Installation

Replace a network interface card (NIC). 

Changes NICs in a system during dynamic reconfiguration. 

How to Replace a Network Interface Card With Dynamic Reconfiguration

Set per-link autopush properties.

Configures STREAMS modules to be pushed on top of a data link. 

How to Set STREAMS Modules on Data Links

Rename a data link. 

Changes the name of a link to any chosen name for better identification. 

How to Rename a Data Link

Display physical attributes of a data link. 

Lists physical information that underly a data link, including type of media, associated device instance, and other information. 

How to Display Information About Physical Attributes of Data Links

Display state of data links. 

Lists information about the status of data links. 

How to Display Data Link Information

Remove a data link. 

Removes a link configuration that is associated with a NIC no longer in use. 

How to Delete a Data Link

ProcedureSPARC: How to Ensure That the MAC Address of an Interface Is Unique

Some applications require every interface on a host to have a unique MAC addresses. However, every SPARC based system has a system-wide MAC address, which by default is used by all interfaces. Here are two situations where you might want to configure the factory-installed MAC addresses for the interfaces on a SPARC system.

The EEPROM parameter local-mac-address? determines whether all interfaces on a SPARC system use the system-wide MAC address or their unique MAC address. The next procedure shows how to use the eeprom command to check the current value of local-mac-address? and change it, if necessary.

  1. On the system with the interfaces to be configured, assume the Primary Administrator role or become superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Determine whether all interfaces on the system currently use the system-wide MAC address.


    # eeprom local-mac-address?
    local-mac-address?=false

    In the example, the response to the eeprom command, local-mac-address?=false, indicates that all interfaces do use the system-wide MAC address. The value of local-mac-address?=false must be changed to local-mac-address?=true before the interfaces can become members of an IPMP group. You should also change local-mac-address?=false to local-mac-address?=true for aggregations.

  3. If necessary, change the value of local-mac-address? as follows:


    # eeprom local-mac-address?=true
    

    When you reboot the system, the interfaces with factory-installed MAC addresses now use these factory settings, rather than the system-wide MAC address. Interfaces without factory-set MAC addresses continue to use the system-wide MAC address.

  4. Check the MAC addresses of all the interfaces on the system.

    Look for cases where multiple interfaces have the same MAC address. In this example, all interfaces use the system-wide MAC address 8:0:20:0:0:1.


    ifconfig -a
    lo0: flags=1000849 <UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
          inet 127.0.0.1 netmask ff000000  
    hme0: flags=1004843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
          inet 10.0.0.112 netmask ffffff80 broadcast 10.0.0.127
          ether 8:0:20:0:0:1 
    ce0: flags=1004843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
          inet 10.0.0.114 netmask ffffff80 broadcast 10.0.0.127
          ether 8:0:20:0:0:1 
    ce1: flags=1004843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
          inet 10.0.0.118 netmask ffffff80 broadcast 10.0.0.127
          ether 8:0:20:0:0:1

    Note –

    Continue to the next step only if more than one network interface still has the same MAC address. Otherwise, go on to the final step.


  5. If necessary, manually configure the remaining interfaces so that all interfaces have unique MAC address.

    Specify a unique MAC address in the /etc/hostname.interface file for the particular interface.

    In the example in Step 4, you would need to configure ce0 and ce1 with locally administered MAC addresses. For example, to reconfigure ce1 with the locally administered MAC address 06:05:04:03:02, you would add the following line to /etc/hostname.ce1:


    ether 06:05:04:03:02 
    

    Note –

    To prevent any risk of manually configured MAC addresses conflicting with other MAC addresses on your network, you must always configure locally administered MAC addresses, as defined by the IEEE 802.3 standard.


    You also can use the ifconfig ether command to configure an interface's MAC address for the current session. However, any changes made directly with ifconfig are not preserved across reboots. Refer to the ifconfig(1M) man page for details.

  6. Reboot the system.

ProcedureHow to Configure an IP Interface After System Installation

Link configuration and IP interface configuration are two separate tasks. However, the following procedure combines the two tasks together to illustrate how an IP interface is created that has the same name as the data link. Thus, after plumbing an IP interface, for example, the link name is propagated up to the IP administrative and programmatic interfaces.

  1. On the system with the interface to be configured, assume the Primary Administrator role or become superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Display information about physical attributes of data links currently on the system.


    # dladm show-phys
    

    For more information about this command, see How to Display Information About Physical Attributes of Data Links.

  3. If you intend to rename a data link, then make sure that the link is not opened by any application.

    For example, if the IP interface over the link is plumbed, then unplumb the interface.


    # ifconfig interface unplumb
    

    where interface refers to the IP interface that is plumbed and using the link.

  4. (Optional) Assign a meaningful name to the data link.


    # dladm rename-link old-linkname new-linkname
    
    old-linkname

    Refers to the current name of the data link. When a NIC is installed for the first time, by default, the NIC's link name is hardware-based, such as bge0.

    new-linkname

    Refers to any name that you want to assign to the data link. For rules for assigning link names, refer to Rules for Valid Link Names.


    Note –

    Although this step is optional, assigning a customized name to a link is recommended. For more information, see Considerations for Working With Link Names.


  5. Configure the IP interface over the link with a valid IP address..


    # ifconfig interface plumb IP-address up
    

    where interface refers to the IP interface you are configuring over the link and the IP-address uses the the CIDR notation. The IP interface is identified by the name of the link. Thus, if you renamed the link in the previous step, you use the same name when you configure the IP interface. See the example that follows this procedure for reference.

    This step also brings that IP address up and enables the IP interface.

    For arguments that you can use with the ifconfig command such as broadcast, refer to the ifconfig(1M) man page. See also Monitoring the Interface Configuration With the ifconfig Command for examples of the different usages of the command.


    Note –

    This step and all subsequent steps that describe the configuration of an IP interface apply to IPv4 interfaces. To configure IPv6 interfaces, refer to Configuring an IPv6 Interface in System Administration Guide: IP Services


  6. (Optional) Display the network data-link information.


    # dladm show-link
    

    For more information about this command, see How to Display Data Link Information.

  7. (Optional) Display information about the newly configured IP interface.


    # ifconfig interface
    
  8. (Optional) To make the interface configuration persist across reboots, perform the following steps:

    1. Create an /etc/hostname.interface file for the IP interface.

    2. Using a text editor, edit the /etc/hostname.interface file by adding the IP address.

      At a minimum, add the IPv4 address of the interface to the file. The address can be in traditional IPv4 notation or CIDR notation. For example, you can also use the following syntax:


      # echo IP-address > /etc/hostname.interface
      
    3. Add entries for the IP addresses into the /etc/inet/hosts file.

      The entries in this file consist of IP addresses and the corresponding host names.

    4. Reboot the system.


      # reboot
      

Example 2–1 Configuring the Network Interface

This example uses partial information from Figure P–2 to configure the data link qfe3 on the host campus01. The example also shows a persistent configuration.


# dladm show-phys
LINK     MEDIA        STATE     SPEED     DUPLEX     DEVICE
qfe3     Ethernet     up        100Mb     full       qfe3

# ifconfig qfe3 unplumb
# dladm rename-link qfe3 subitops1
# ifconfig subitops1 plumb 192.168.84.3/24 up
# dladm show-link
LINK          CLASS     MTU     STATE     OVER
subitops1     phys      1500    up        --

# ifconfig subitops1
subitops1: flags=1000843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.84.3 netmask ffffff00 broadcast 192.168.84.255
        ether 8:0:20:c8:f4:1d 

# echo 192.168.84.3/24 > /etc/hostname.subitops1

# vi /etc/inet/hosts
# Internet host table
#
127.0.0.1       localhost
10.0.0.14       myhost
192.168.84.3       campus01

# reboot

ProcedureHow to Replace a Network Interface Card With Dynamic Reconfiguration

Aside from servers, most laptops have PCMCIA slots that support dynamic reconfiguration (DR). This procedure shows how DR is now facilitated by the separation of the network link configuration from the network hardware configuration. You no longer need to reconfigure your network links after you complete DR. Instead, you just transfer the link configurations of the removed NIC to be inherited by the replacement NIC.

Before You Begin

Procedures to perform DR vary with the type of system. Make sure that you complete the following first:

  1. Assume the proper role that allows you to perform DR on the system, such as the Primary Administrator role or superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. (Optional) Display information about physical attributes of data links currently on the system.


    # dladm show-phys
    
  3. Perform the DR procedures as detailed in your system's documentation to remove a NIC and then insert a replacement NIC.

    Consult your system's DR documentation to perform this step.

    After you have installed the replacement NIC, proceed to the next step.

  4. Make sure that the replacement NIC is not being referenced by other configurations in the system.

    For example, the replacement NIC you install is ce0. If a file /etc/hostname.ce0 exists in the system, remove that file.

  5. Transfer the link configuration of the removed NIC to the replacement NIC.


    # dladm rename-link replacementNIC-linkname removedNIC-linkname
    
    replacementNIC-linkname

    Refers to the default link name of the replacement NIC upon installation. When you insert a NIC into a system for the first time, the NIC's link name is hardware-based, such as bge0 or ce0.

    removedNIC-linkname

    Refers to the customized link name of the NIC that you removed.

  6. Complete the DR process by enabling the new NIC's resources to become available for use by the Solaris release.

    For example, you use the cfgadm command to configure the NIC. For more information see the cfgadm(1M) man page.

  7. (Optional) Display link information.

    For example, you can use either dladm show-phys or dladm show-link to show information about the data links.


Example 2–2 Replacing a Network Card

This example shows how a bge card with link name net0 is replaced by a ce card. The link configurations of net0 are transferred from bge to ce after ce is connected to the system.


# dladm show-phys
LINK          MEDIA        STATE     SPEED     DUPLEX     DEVICE
subitops1     Ethernet     up        100Mb     full       qfe3
net0          Ethernet     up        100Mb     full       bge0

You perform the DR-specific steps such as using cfgadm to disconnect bge and then install ce. Then the procedure continues.


# ls /etc/hostname.*
hostname.ce0

# rm /etc/hostname.ce0
# dladm rename-link ce0 net0

# dladm show-phys
LINK        MEDIA        STATE     SPEED     DUPLEX     DEVICE
subitops1   Ethernet     up        100Mb     full       qfe3
net0        Ethernet     up        100Mb     full       ce0

Configuring STREAMS Modules on Data Links

If necessary, you can set up to eight STREAMS modules to be pushed on top of a data link. These modules are typically used by third-party networking software such as virtual private networks (VPNs) and firewalls. Documentation about such networking software is provided by the software vendor.

The list of STREAMS modules to push on a specific data link is controlled by the autopush link property. In turn, the value of the autopush link property is set by using the dladm set-linkprop subcommand.

A separate autopush command can also be used to set the STREAMS autopush modules on a per-driver basis. However, the driver is always bound to the NIC. If the data link's underlying NIC is removed, then the link's autopush property information becomes lost as well.

To configure the STREAMS modules to be pushed on top of a data link, use the dladm set-linkprop command in preference over the autopush command. If both per-driver and per-link types of autoputsh configuration exist for a specific data link, the per-link information that is set with dladm set-linkprop is used and the per-driver information is ignored.

ProcedureHow to Set STREAMS Modules on Data Links

The following procedure describes how to configure STREAMS modules with the dladm set-linkprop command.

  1. Assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Push the modules to the stream when the link is opened.


    # dladm set-linkprop -p autopush=modulelist link
    
    modulelist

    Specifies the list of modules that you want to be automatically pushed on to the stream. A maximum of eight modules can be pushed over a link. These modules are pushed in the order that they are listed in modulelist. Separate the modules in the list by using dots as delimiters.

    link

    Specifies the link on which the modules are pushed.


Example 2–3 Setting the autopush Link Property

In this example, you push the vpnmod and bufmod modules on top of the link net0. The link's underlying device is bge0.


# dladm set-linkprop -p autopush=vpnmod.bufmod net0

If you later replace the bge card with ce, you can switch to the new data link without needing to reconfigure the autopush settings. You just assign the link name to the new data link, as follows:


# dladm rename-link ce0 net0

ProcedureHow to Obtain autopush Link Property Settings

  1. Assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Display autopush link property settings.


    # dladm show-linkprop -p autopush [link]
    

    If you do not specify link, then the information for all configured links is displayed.

ProcedureHow to Remove autopush Link Property Settings

  1. Assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Remove the autopush link property settings of a specific data link.


    # dladm reset-linkprop [-t] -p autopush link
    

    Use the -t option to remove the property settings temporarily. The settings are restored when you reboot the system.

Link Administration and Monitoring

New and revised dladm subcommands are now available to work with link names. This section specifically discusses the subcommands show-phys and show-link. Other commands that display information are discussed in their respective chapters that describe the specific network setups, such as link aggregations and VLAN configurations.

ProcedureHow to Rename a Data Link

Use this procedure if you want to change a data link name, for example, to assign a meaningful name that would easily identify the link's role within your network setup.

Before You Begin

Make sure that you have studied and prepared for other steps you need to perform on associated configurations that might be affected by the change of link names. For more information, see Considerations for Working With Link Names.

  1. On the system on which you want to rename a data link, assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Unplumb the IP interface.


    # ifconfig interface unplumb
    
  3. Change the link's current link name.


    # dladm rename-link old-linkname new-linkname
    
    old-linkname

    Refers to the current name of the data link. By default, the link name is hardware-based, such as bge0.

    new-linkname

    Refers to any name that you want to assign to the data link. For rules for assigning link names, refer to Rules for Valid Link Names. See also Considerations for Working With Link Names for further information about renaming data links.

    If you do not want the new link name to persist across a system reboot, then use the -t option immediately after the subcommand. The option renames a link temporarily. The original link name reverts when the system is rebooted.


    Note –

    You can use dladm rename-link to transfer link configurations from one data link to another. For an example, see How to Replace a Network Interface Card With Dynamic Reconfiguration. When you rename a link for this purpose, make sure that the link that is inheriting the configuration does not have any prior existing configurations. Otherwise, the transfer fails.



Example 2–4 Changing a Link Name

The following example shows how a link name is changed from a hardware-based name to a customized name.


# dladm rename-link bge0 net0

ProcedureHow to Display Information About Physical Attributes of Data Links

This procedure lists the steps to display information about the physical attributes of a system's data links.

  1. On the system, assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Display information about physical attributes of data links currently on the system.


    # dladm show-phys -P
    

    You can use the -P with this command to also display data links that are flagged as unavailable. A data link becomes unavailable if its associated hardware has been removed. Without the -P option, the command displays only available data links.

    To view the /devices path of the data links, use the -v option.


Example 2–5 Displaying Available Data Links

In the following example, the -P option includes the FLAGS column where unavailable links are indicated. The r flag for the data link net0 indicates the hardware that is associated with the link (eri) has been removed.


# dladm show-phys -P
LINK        MEDIA          STATE     SPEED     DUPLEX     DEVICE   FLAGS
subitops1   Ethernet       up        100Mb     full       qfe3     -----
ibd0        Infiniband     down      0Mb       --         ibd0     -----
subitops0   Ethernet       up        100Mb     full       ce0      -----
net0        Ethernet       --        0Mb       --         eri0     r----

The following example shows the output that is generated when you use the -v option.


# dladm show-phys -v
LINK     PATH
net2     /pci@1f,700000/network@2
ibd3     /pci@1d,700000/network@2
bge3     /pci@1f,700000/network@2,1

ProcedureHow to Display Data Link Information

This procedure displays the status of available links.

  1. Assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Display link information.


    # dladm show-link
    

Example 2–6 Displaying Available Links

The following example shows persistent and available links on the system.


# dladm show-link -P
LINK        CLASS     OVER
subitops1   phys      --
ibd0        phys      --
eri0        phys      --

The -P option also displays any existing persistent but unavailable links. A persistent link becomes unavailable if the link is temporarily deleted. A link also becomes unavailable if the associated hardware has been removed.


ProcedureHow to Delete a Data Link

This procedure deletes link configurations that are associated with NICs. If you detach a NIC without intending to replace it, then you can delete the link configuration that is associated with that NIC. After you complete this procedure, the link name can be reused.

  1. On the system with the interfaces to be configured, assume the System Administrator role.

    The System Administrator role includes the Network Management profile. To create the role and assign the role to a user, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Display the data links on the system including those links whose hardware have been removed.

    To include information about removed hardware, use the -P option.


    # dladm show-phys -P
    
  3. Remove the link configuration of the removed hardware that you do not intend to replace.


    # dladm delete-phys link
    

Example 2–7 Deleting a Data Link

In the following example, the r flag for net0 indicates that the link's associated hardware (ce) has been removed. Therefore, you can also remove the link net0 and then reassign the name to a new data link.


# dladm show-phys -P
LINK        DEVUCE     MEDIA        FLAGS
mylink0     qfe0       Ethernet     -----
eri0        eri0       Ethernet     -----
net0        ce0        Ethernet     r----

# dladm delete-phys net0