Less known Solaris features: hxbt - or: WAN emulation
Some features are so “less known” that even people with the reputation of knowing almost everything about Solaris aren’t aware of them. One of this features is the hxbt driver. In this tutorial i want to explain how you get this drive and how you install and use it.
What is hxbt?
Whenever you are testing an application or feature there is a single infrastructure component that’s somewhat hard to test. It’s the network between a client and a server … or between two servers replicating data between them. At LAN speed everything is fine, but what’s with WAN speed. 1 GBps leased lines aren’t that common and latencies from your notebook to the server under your desktop aren’t really representative.
So it would be nice too simulate a WAN connection, with longer delays, with corrupted or missing packets to test this functionality.
With hxbt there is a STREAMS driver for Solaris that implements such a WAN simulation that’s able to simulate certain characteristics of a wide area connection.
You will find the hxbt driver for SPARC as well as for x86 in the tarball.
When you are using an x86 system, you have to copy it from here:
When you are using a SPARC system, then you have to use a different driver:
Independent from the architecture you have to copy hxbt.conf into the correct location.
Obviously you need a tool to configure the WAN emulation. This tool is ifhit. However it gets a little bit difficult here. The tarball at opensolaris.org just contains the ifhit tool for SPARC. So when you use a SPARC system just copy the tool from the untarred distribution:
In the case you want to use hxbt you have to compile the tool on your own. To make it a little bit easier, i’ve compiled a version for you … you will find it at my website.
Okay, now we have to add the driver and create the /dev/hxbt device node.
The hxbt is an STREAMS driver that sit’s between higher protocol layers and the network hardware driver. We have to insert it here, but at first we have to find the exact location in the stack.
Okay, the network hardware driver is at position 1, we want to insert the hxbt there, so so we put that driver at that location
Now we check if everything went well …
Perfect … not let’s make a last check if the driver is really loaded .. just to be sure …
Using hxbt
Let’s play around with it … let’s assume we want to introduce an additional latency of 100 ms to our communication to the IP address 192.168.2.200:
Let’s check it …
As you surely have noticed, the ping time is got longer. Okay … let’s remove this artifical latency. You use the -z option for this task.
Let’s check the ping times …
They look vastly more normal than the ones with the artificial delay.Let’s use a more complex pattern of problems.
This command introduces a packet drop every 5 packets, two packets will be dropped with an undropped packet between them.
</small>As you surely have noticed, you see that the fifth and the seventh package has been dopped by htbx.
There are a lot of other options to introduce limits, latencies or problems to a network connection. As there is no man page for the tool, i will just post the printout:
Conclusion
htbx is really useful, especially for test environments. In the past i’ve used it to demonstrate the impact of network latencies to synchronous storage replication. It’s a pity that it’s isn’t a part of any Solaris distribution.