Creating and deleting VNICs in OpenSolaris

OpenSolaris
A physical network adapter is also called a Network Interface Card or in short a NIC. The Crossbow project in OpenSolaris added more virtualization capabilities to the existing network stack starting from OpenSolaris Build 105. The latest OpenSolaris version 2009.06 has Crossbow features enabled.

A virtual NIC, or in short a VNIC, is a pseudo network interface created over an existing physical NIC. A phisical NIC can have more than one VNICs on it. Each VNICs created will have a separate MAC address. It is possible to make use of Crossbow's resource management to control bandwidth through VNICs.

In OpenSolaris with Crossbow, it is possible to create virtual NICs using Data Link Administration command dladm. To create a virtual NIC over an existing physical NIC, e1000g0, execute
# dladm create-vnic -t -l e1000g0 vnic1

We passed -t to dladm to indicate that the VNIC is to be made temporary meaning that the VNIC is available until we either reboot the system or delete it through dladm. To create persistent VNICs, remove -t from the above.

The option -l e1000g0 indicate that the VNIC is to be created over physical interface e1000g0. The name of newly created VNIC will be vnic1. This was passed as last argument to dladm.

To delete an VNIC, we again use dladm command.
# dladm delete-vnic vnic1

To make use of VNICs created through dladm, they need to be plumbed and assigned a valid IP address. In short, VNICs are similar to any physical NICs once they are created.
# ifconfig vnic1 plumb
# ifconfig vnic1 1.1.1.1 up
# ifconfig vnic1 down
# ifconfig vnic1 unplumb

Read More...
Bookmark and Share
Your Ad Here

Process and Thread counts

Computer
While using any operating system, at any time, there may be a need to know the number of active processes and threads. In Microsoft Windows operating systems, it is possible through different GUI-based tools like Windows Built-in Task Manager, SysInternals Process Explorer etc. But in Unix, Linux or any of the Unix variant operating systems, we normally look for commands to get things done.

The below commands have been tested in OpenSolaris so far. They are expected to work on Linux and other Unix variant operating systems as well.

For example, to find the number of iperf processes,
# ps -ef | grep iperf | grep -v "grep" | wc -l

If you know how this works, you can then skip this paragraph. The first command ps is the key command which gets us all running processes at that time. The output of ps is then piped to grep. The grep command is used to search for lines containing iperf (the process we are interested in). Since grep will also be listed as a process with iperf word in the same line, we need to get rid of that entry. Otherwise, our list will have one extra entry which we are not interested in. So, we have second grep. Here we remove all lines containing word grep in the lines from first grep. The last command wc (word count) is used to get count of lines which is nothing but the number of running iperf processes.

Similarly to find the number of iperf threads,
# ps -eLf | grep iperf | grep -v "grep" | wc -l

Here the only change is in the arguments passed to ps command. The argument -L hints ps to look for only light weight processes (also called threads).

There is one more way of finding the number of threads. In this method, we make use of mdb, the modular debugger.

To find the number of iperf threads using this method, execute
# echo ::threadlist | mdb -k | grep iperf | wc -l

Here passing ::threadlist to mdb shows a list of threads running in the system. In that list, grep for iperf and find the count of lines.

Read More...
Bookmark and Share
Your Ad Here