Ref:
http://docs.oracle.com/cd/E23824_01/html/821-1458/gkipd.html#
The dladm Command
After the full implementation of the GLDv3 driver configuration framework, the dladm command has acquired expanded capabilities over time. The framework enhances configuration of NIC drivers as follows:
· Only a single command interface, the dladm command, is needed to configure network driver properties.
· A uniform syntax is used regardless of the properties: dladm subcommand properties datalink.
· Use of the dladm command applies to both public and private properties of the driver.
· Using the dladm command on a specific driver does not disrupt network connections of other NICs of similar types. Thus, you can configure datalink properties dynamically.
· Datalink configuration settings are stored in a dladm repository and persist even after you reboot the system.
To avail of the advantages previously listed when you configure datalinks, you should use dladm as the configuration tool instead of the customary tools in previous releases, such as the ndd command.
To administer datalinks, you use the following dladm subcommands:
· dladm rename-link changes the name of a datalink.
· dladm show-link displays existing datalinks in the system.
· dladm show-phys displays physical attributes of datalinks.
· dladm delete-phys deletes a datalink.
· dladm show-linkprop displays the properties that are associated with the datalink.
· dladm set-linkprop sets specified datalink properties.
· dladm reset-linkprop restores properties to their default settings.
· dladm show-ether displays Ethernet parameter settings of a datalink.
The dladm command is also used to perform other types of link administration, such as the following:
· Configuring bridges. See Chapter 11, Administering Bridges
· Configuring link aggregations. See Chapter 12, Administering Link Aggregations
· Configuring VLANs. See Chapter 13, Administering VLANs
· Configuring tunnels. See Chapter 6, Configuring IP Tunnels, in Oracle Solaris Administration: IP Services.
For more information about the commands, see the dladm(1M) man page.
The following procedures show how to use the dladm command to configure datalinks. In most cases, datalink configuration is a part of the configuration of an IP interface over that link. Thus, where applicable, the procedures include IP interface configuration steps with the ipadm command. However, IP interface configuration and the ipadm command are discussed in further detail in Chapter 9, Configuring an IP Interface.
How to Rename a Datalink
Use this procedure if you want to change a datalink name to a customized name. For example, some of the datalinks in upgraded system might have retained legacy hardware-based names and you want to change these names to generic ones.
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 Link Names in Upgraded Systems.
1. Become an administrator.
For more information, see How to Obtain Administrative Rights in Oracle Solaris Administration: Security Services.
2. If an IP interface is configured over the datalink, remove the IP interface.
# ipadm delete-ip interface
3. Change the link's current link name.
# dladm rename-link old-linkname new-linkname
old-linkname
Refers to the current name of the datalink. By default, the link name is hardware-based, such as bge0.
new-linkname
Refers to any name that you want to assign to the datalink. For rules for assigning link names, refer to Rules for Valid Link Names. See also Link Names in Upgraded Systems for further information about renaming datalinks.
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 datalink 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 8-1 Changing the System's Primary Network Interface
The following example shows how you can switch the primary network interface on your system to a second NIC by renaming datalinks. The system's primary network interface is net0, the generic name of the datalink on e1000g0. This primary network interface will be switched from using e1000g0 as the underlying interface to nge0. You can use this example as part of the procedure to create a new boot environment.
# dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
net0 Ethernet up 1000 full e1000g0
net1 Ethernet up 1000 full nge0
# dladm rename-link net0 oldnet0
# dladm rename-link net1 net0
# dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
oldnet0 Ethernet up 1000 full e1000g0
net0 Ethernet up 1000 full nge0
How to Display Information About Physical Attributes of Datalinks
This procedure lists the steps to display information about the physical attributes of a system's datalinks.
1. Become an administrator.
For more information, see How to Obtain Administrative Rights in Oracle Solaris Administration: Security Services.
2. Display information about physical attributes of datalinks currently on the system.
# dladm show-phys
You can use the -P with this command to also display flag status of each link. A datalink becomes unavailable if its associated hardware has been removed. Without the -P option, the command displays only available datalinks.
To view the /devices path of the datalinks, use the -v option.
Example 8-2 Displaying Available Datalinks
In the following example, the -P option includes the FLAGS column where unavailable links are indicated. The r flag for the datalink net0 indicates the hardware that is associated with the link (nge) has been removed.
# dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
net0 Ethernet up 100Mb full e1000g0
net1 Infiniband down 0Mb -- ibd0
net3 Ethernet up 100Mb full bge0
net4 Ethernet -- 0Mb -- nge0
The following example shows the links and their physical locations that are displayed when you use the -L option.
# dladm show-phys -L
LINK DEVICE LOCATION
net0 bge0 MB
net2 ibp0 MB/RISER0/PCIE0/PORT1
net3 ibp1 MB/RISER0/PCIE0/PORT2
net4 eoib2 MB/RISER0/PCIE0/PORT1/cloud-nm2gw-2/1A-ETH-2
How to Display Datalink Information
This procedure displays the status of available links.
1. Become an administrator.
For more information, see How to Obtain Administrative Rights in Oracle Solaris Administration: Security Services.
2. Display link information.
# dladm show-link
Example 8-3 Displaying Available Links
The following example shows persistent and available links on the system.
# dladm show-link -P
LINK CLASS BRIDGE OVER
net0 phys -- --
net1 phys -- --
net2 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.
How to Delete a Datalink
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. Become an administrator.
For more information, see How to Obtain Administrative Rights in Oracle Solaris Administration: Security Services.
2. Display the datalinks on the system including those links whose hardware have been removed.
To include information about removed hardware, use the -P option.
# dladm show-phys
3. Remove the link configuration of the removed hardware that you do not intend to replace.
# dladm delete-phys link
Example 8-4 Deleting a Datalink
In the following example, the r flag for net2 indicates that the link's associated hardware (e1000g0) has been removed. Therefore, you can also remove the link net2and then reassign the name to a new datalink.
# dladm show-phys -P
LINK DEVICE MEDIA FLAGS
net0 nge0 Ethernet -----
net1 bge0 Ethernet -----
net2 e1000g0 Ethernet r----
# dladm delete-phys net2
沒有留言:
張貼留言