Many of SoftLayer’s solutions make excellent use of the Brocade vRouter (Vyatta) dedicated security appliance. It’s a true network gateway, router, and firewall for your servers in a SoftLayer data center. It’s also an invaluable trouble-shooting tool should you have a connectivity issue or just want to take a gander at your network traffic. Built into vRouter’s command line and available to you, is a full-fledged terminal-based Wireshark command line implementation—TShark.
TShark is fully implemented in vRouter. If you’re already familiar with using TShark, you know you can call it from the terminal in either configuration or operational mode. You accomplish this by prefacing a command with
sudo; making the full command
sudo tshark – flags.
For those of us less versed in the intricacies of Wireshark and its command line cousin, here are a couple of useful examples to help you out.
One common flag I use in nearly every capture is
–i (and as a side note, for those coming from a Microsoft Windows background, the flags are case sensitive).
-i is a specific interface on which to capture traffic and immediately helps to cut down on the amount of information unrelated to the problem at hand. If you don’t set this flag, the capture will default to “the first non-loopback address;” or in the case of vRouter on SoftLayer,
Bond0. Additionally, if you want to trace a packet and reply, you can set
–i any to watch or capture traffic through all the interfaces on the device.
The second flag that I nearly always use to define a capture filter is
–f, which defines a filter to match traffic against. The only traffic that matches this pattern will be captured. The filter uses the standard Wireshark syntax. Again, if you’re familiar with Wireshark, you can go nuts; but here are a few of the common filters I frequently use to help you get started:
host 188.8.131.52will match any traffic to or from the specified host. In this case, the venerable Google DNS servers.
net 184.108.40.206/24works just like
host, but for the entire network specified, in case you don’t know the exact host address you are looking for.
srcare useful if you want to drill down to a specific flow or want to look at just the incoming or outgoing traffic. These filters are usually paired with a
netto match against.
portlets you specify a port to capture traffic, like
net. Used by itself,
portwill match both source and destination port. In the case of well-known services, you can also define the port by the common name, i.e.,
One final cool trick with the
–f filter is the
and and the negation not. They let you combine search terms and specifically exclude traffic in order to create a very finely tuned capture for your needs.
If you want to capture to a file to share with a team or to plug into more advanced analysis tools on another system, the
–w flag is your friend. Without
-w, the file will behave like a
tcpdump and the output will appear in your terminal session. If you want to load the file into Wireshark or another packet analyzer tool you should make sure to add the
–F flag to specify the file format. Here is an example:
Vyatta# sudo tshark –i Bond0 –w testcap.pcap –F pcap –f ‘src 10.128.3.5 and not port 80’
The command will capture on
Bond0 and output the capture to a
.pcap file called
testcap.pcap in the root directory of the file system. It will match only traffic on
10.128.3.5 that is not source or destination port 22. While that is a bit of a mouthful to explain, it does capture a very well defined stream!
Here is one more example:
Vyatta#sudo tshark –I any –f ‘host 10.145.23.4 and not ssh’
This command will capture traffic to the terminal that is to or from the specified IP (
10.145.23.4) that is not SSH. I frequently use this filter, or one a lot like it, when I am SSHed into a host and want to get a more general idea of what it is doing on the network. I don’t care about ssh because I know the cause of that traffic (me!), but I want to know anything else that’s going to or from the host.
This is all very much the tip of the iceberg; you can find a lot more information at the TShark main page. Hopefully these tips help out next time you want to see just what traffic is passing through your gateway.