|By Hurricane Labs||
|March 20, 2012 04:12 PM EDT||
The Ins and Outputs of TCPDUMP
By: Nicholas Beris
As a Network Engineer, I spend a lot of time on, in, and around the terminal. Many of the systems that I work with are remote and taking the time to download a packet capture in the middle of an emergency call and waiting for Wireshark to get the necessary details is just too much of a hassle. (Plus, it makes me feel like I’m an operator in the Matrix with the scrolling code.) Now don’t get me wrong, Wireshark is a great tool and has many uses, but a lot of times it’s just not practical. Besides, are you really going to download the packets from a snort alert and pump them into Wireshark? This my friends is where Tcpdump comes into play and shines.
What is Tcpdump?
Tcpdump is the most commonly and widely used tool to analyze and intercept various types of Ethernet traffic. A network administrator, security auditor, or anyone else dealing in the end to end connectivity of their infrastructure will find this tool pre-installed most of time. Many times when working with third party vendors, sometimes you have to prove that its isn’t your network, firewall, or NAT causing the issue with the application and its just poor coding on their end.
First we will look at some simple traffic and in this case will be an apt install of 2 packages.
The following is the command that I used to to ‘capture’ or record this network traffic.
tcpdump -s 1500 -Avvvn -i wlan0 -w package.pcap host 18.104.22.168
tcpdump: Name of the application.
-s 1500: Snap length is how much of the packet to get. The default is 65535 bytes. Setting the snap length to 0 sets it to it’s default. (According to the man page for my version)
-A: Prints the packet in ASCII. Useful for plain text traffic and application troubleshooting.
-vvv: Very very verbose – Prints more information about the packet such as TTL and a lot more
-n: Won’t convert address to human names
-i: Which interface to listen and capture on
-w: Write the packet to said file name
host: The remote peer
Now that we have successfully written the packets to a file we can now analyze the traffic. In any type of troubleshooting situation you have to start at square one. Lets open this file and pipe it into something useful instead of filling the scroll back buffer and missing the first essential connection details.
Since the TCP/IP stack has retransmission as part of the protocol if the first few packets fail then the rest of the connection is doomed.
tcpdump -s 1500 -Avvvn -r package.pcap | less
The -r switch reads the file instead of writing it. Since we already filtered out any other traffic with the host argument we don’t need to be as detailed in our command. The | (pipe) means direct the standard output (console screen) to another application, in the case “less”. This give us the ability to scroll through the whole .pcap file.
The first the 3 packets represent the 3 way-handshake which every TCP connection must go through to set up the connection.
12:26:58.632628 IP (tos 0x0, ttl 64, id 20547, offset 0, flags [DF]
, proto TCP (6), length 60)
10.0.1.38.59181 > 22.214.171.124.80: Flags [S], cksum 0xb5e9 (cor
rect), seq 1526109302, win 5840, options [mss 1460,sackOK,TS val 68
00437 ecr 0,nop,wscale 7], length 0
12:26:58.663268 IP (tos 0x0, ttl 51, id 0, offset 0, flags [DF], pr
oto TCP (6), length 60)
126.96.36.199.80 > 10.0.1.38.59181: Flags [S.], cksum 0x7075 (co
rrect), seq 2554095472, ack 1526109303, win 5792, options [mss 1460
,sackOK,TS val 2580458519 ecr 6800437,nop,wscale 7], length 0
12:26:58.663321 IP (tos 0x0, ttl 64, id 20548, offset 0, flags [DF]
, proto TCP (6), length 52)
10.0.1.38.59181 > 188.8.131.52.80: Flags [.], cksum 0xb5ab (cor
rect), ack 1, win 46, options [nop,nop,TS val 6800445 ecr 258045851
9], length 0
And now my host is sending its HTTP GET request to the remote HTTP server. Remember when I said in the beginning that I was going to install two packages? Well you can see two GET requests made to the server in the output below. Can you tell what I was installing?
12:26:58.663524 IP (tos 0x0, ttl 64, id 20549, offset 0, flags [DF]
, proto TCP (6), length 435)
10.0.1.38.59181 > 184.108.40.206.80: Flags [P.], cksum 0x0d68 (correct), seq 1:384, ack 1, win 46, options [nop,nop,TS val 6800445 ecr 2580458519], length 383
User-Agent: Debian APT-HTTP/1.3 (0.8.10.3)
GET /debian/pool/main/a/awn-extras-applets/awn-applets-python-extras_0.4.0-3_all.deb HTTP/1.1
User-Agent: Debian APT-HTTP/1.3 (0.8.10.3)
How do we know that the server even received our request? TCP will always send an ACK, or in the case of a corrupt packet, a reset (RST) the last packet. As you can see in the following output there is the acknowledge of the GET request and then the server’s HTTP 200 OK response.
12:26:58.693420 IP (tos 0x0, ttl 51, id 52036, offset 0, flags [DF]
, proto TCP (6), length 52)
220.127.116.11.80 > 10.0.1.38.59181: Flags [.], cksum 0xb406 (cor
rect), ack 384, win 54, options [nop,nop,TS val 2580458549 ecr 6800
445], length 0
12:26:58.750220 IP (tos 0x0, ttl 51, id 52037, offset 0, flags [DF]
, proto TCP (6), length 1500)
18.104.22.168.80 > 10.0.1.38.59181: Flags [.], seq 1:1449, ack 3
84, win 54, options [nop,nop,TS val 2580458605 ecr 6800445], length
Date: Sun, 18 Mar 2012 16:27:03 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Mon, 19 Jul 2010 07:02:03 GMT
Content-Type: text/plain; charset=UTF-8
And as they say “the rest is history”. Well, technically the rest is of the TCP stream for my packages, but if you are troubleshooting further than the initial connections you are going to need to roll up your sleeves and have a firm grasp of the TCP protocol. If you’re not as strong at reading packet captures or understanding how the whole TCP/IP stacks work, then this is the best way to learn with simple, easy to define and read traffic. In my next entry I plan on going more in depth with situational examples.
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, will discuss how research has demonstrated the value of Machine Learning in delivering next generation analytics to im...
Apr. 29, 2016 03:45 PM EDT Reads: 1,575
This is not a small hotel event. It is also not a big vendor party where politicians and entertainers are more important than real content. This is Cloud Expo, the world's longest-running conference and exhibition focused on Cloud Computing and all that it entails. If you want serious presentations and valuable insight about Cloud Computing for three straight days, then register now for Cloud Expo.
Apr. 29, 2016 03:30 PM EDT Reads: 1,637
You think you know what’s in your data. But do you? Most organizations are now aware of the business intelligence represented by their data. Data science stands to take this to a level you never thought of – literally. The techniques of data science, when used with the capabilities of Big Data technologies, can make connections you had not yet imagined, helping you discover new insights and ask new questions of your data. In his session at @ThingsExpo, Sarbjit Sarkaria, data science team lead ...
Apr. 29, 2016 03:07 PM EDT
So, you bought into the current machine learning craze and went on to collect millions/billions of records from this promising new data source. Now, what do you do with them? Too often, the abundance of data quickly turns into an abundance of problems. How do you extract that "magic essence" from your data without falling into the common pitfalls? In her session at @ThingsExpo, Natalia Ponomareva, Software Engineer at Google, will provide tips on how to be successful in large scale machine lear...
Apr. 29, 2016 02:45 PM EDT Reads: 782
IoT device adoption is growing at staggering rates, and with it comes opportunity for developers to meet consumer demand for an ever more connected world. Wireless communication is the key part of the encompassing components of any IoT device. Wireless connectivity enhances the device utility at the expense of ease of use and deployment challenges. Since connectivity is fundamental for IoT device development, engineers must understand how to overcome the hurdles inherent in incorporating multipl...
Apr. 29, 2016 02:30 PM EDT Reads: 1,387
The IETF draft standard for M2M certificates is a security solution specifically designed for the demanding needs of IoT/M2M applications. In his session at @ThingsExpo, Brian Romansky, VP of Strategic Technology at TrustPoint Innovation, will explain how M2M certificates can efficiently enable confidentiality, integrity, and authenticity on highly constrained devices.
Apr. 29, 2016 02:00 PM EDT Reads: 961
The paradigm has shifted. A Gartner survey shows that 43% of organizations are using or plan to implement the Internet of Things in 2016. However, not just a handful of companies are still using the old-style ad-hoc trial-and-error ways, unaware of the critical barriers, paint points, traps, and hidden roadblocks. How can you become a winner? In his session at @ThingsExpo, Tony Shan will present a methodical approach to guide the holistic adoption and enablement of IoT implementations. This ov...
Apr. 29, 2016 02:00 PM EDT Reads: 1,520
We’ve worked with dozens of early adopters across numerous industries and will debunk common misperceptions, which starts with understanding that many of the connected products we’ll use over the next 5 years are already products, they’re just not yet connected. With an IoT product, time-in-market provides much more essential feedback than ever before. Innovation comes from what you do with the data that the connected product provides in order to enhance the customer experience and optimize busi...
Apr. 29, 2016 02:00 PM EDT Reads: 813
Artificial Intelligence has the potential to massively disrupt IoT. In his session at 18th Cloud Expo, AJ Abdallat, CEO of Beyond AI, will discuss what the five main drivers are in Artificial Intelligence that could shape the future of the Internet of Things. AJ Abdallat is CEO of Beyond AI. He has over 20 years of management experience in the fields of artificial intelligence, sensors, instruments, devices and software for telecommunications, life sciences, environmental monitoring, process...
Apr. 29, 2016 01:30 PM EDT Reads: 763
SYS-CON Events announced today that Ericsson has been named “Gold Sponsor” of SYS-CON's @ThingsExpo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. Ericsson is a world leader in the rapidly changing environment of communications technology – providing equipment, software and services to enable transformation through mobility. Some 40 percent of global mobile traffic runs through networks we have supplied. More than 1 billion subscribers around the world re...
Apr. 29, 2016 01:00 PM EDT Reads: 727
SYS-CON Events announced today that Stratoscale, the software company developing the next generation data center operating system, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Stratoscale is revolutionizing the data center with a zero-to-cloud-in-minutes solution. With Stratoscale’s hardware-agnostic, Software Defined Data Center (SDDC) solution to store everything, run anything and scale everywhere...
Apr. 29, 2016 01:00 PM EDT Reads: 1,474
Angular 2 is a complete re-write of the popular framework AngularJS. Programming in Angular 2 is greatly simplified – now it's a component-based well-performing framework. This immersive one-day workshop at 18th Cloud Expo, led by Yakov Fain, a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay, will provide you with everything you wanted to know about Angular 2.
Apr. 29, 2016 12:30 PM EDT Reads: 1,623
SYS-CON Events announced today that Men & Mice, the leading global provider of DNS, DHCP and IP address management overlay solutions, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. The Men & Mice Suite overlay solution is already known for its powerful application in heterogeneous operating environments, enabling enterprises to scale without fuss. Building on a solid range of diverse platform support,...
Apr. 29, 2016 11:45 AM EDT Reads: 2,207
In his session at @ThingsExpo, Chris Klein, CEO and Co-founder of Rachio, will discuss next generation communities that are using IoT to create more sustainable, intelligent communities. One example is Sterling Ranch, a 10,000 home development that – with the help of Siemens – will integrate IoT technology into the community to provide residents with energy and water savings as well as intelligent security. Everything from stop lights to sprinkler systems to building infrastructures will run ef...
Apr. 29, 2016 11:30 AM EDT Reads: 464
You deployed your app with the Bluemix PaaS and it's gaining some serious traction, so it's time to make some tweaks. Did you design your application in a way that it can scale in the cloud? Were you even thinking about the cloud when you built the app? If not, chances are your app is going to break. Check out this webcast to learn various techniques for designing applications that will scale successfully in Bluemix, for the confidence you need to take your apps to the next level and beyond.
Apr. 29, 2016 11:15 AM EDT Reads: 1,406
Manufacturers are embracing the Industrial Internet the same way consumers are leveraging Fitbits – to improve overall health and wellness. Both can provide consistent measurement, visibility, and suggest performance improvements customized to help reach goals. Fitbit users can view real-time data and make adjustments to increase their activity. In his session at @ThingsExpo, Mark Bernardo Professional Services Leader, Americas, at GE Digital, will discuss how leveraging the Industrial Interne...
Apr. 29, 2016 10:00 AM EDT Reads: 1,104
Whether your IoT service is connecting cars, homes, appliances, wearable, cameras or other devices, one question hangs in the balance – how do you actually make money from this service? The ability to turn your IoT service into profit requires the ability to create a monetization strategy that is flexible, scalable and working for you in real-time. It must be a transparent, smoothly implemented strategy that all stakeholders – from customers to the board – will be able to understand and comprehe...
Apr. 29, 2016 09:30 AM EDT Reads: 979
Increasing IoT connectivity is forcing enterprises to find elegant solutions to organize and visualize all incoming data from these connected devices with re-configurable dashboard widgets to effectively allow rapid decision-making for everything from immediate actions in tactical situations to strategic analysis and reporting. In his session at 18th Cloud Expo, Shikhir Singh, Senior Developer Relations Manager at Sencha, will discuss how to create HTML5 dashboards that interact with IoT devic...
Apr. 29, 2016 09:00 AM EDT Reads: 825
The increasing popularity of the Internet of Things necessitates that our physical and cognitive relationship with wearable technology will change rapidly in the near future. This advent means logging has become a thing of the past. Before, it was on us to track our own data, but now that data is automatically available. What does this mean for mHealth and the "connected" body? In her session at @ThingsExpo, Lisa Calkins, CEO and co-founder of Amadeus Consulting, will discuss the impact of wea...
Apr. 29, 2016 08:45 AM EDT Reads: 590
There is an ever-growing explosion of new devices that are connected to the Internet using “cloud” solutions. This rapid growth is creating a massive new demand for efficient access to data. And it’s not just about connecting to that data anymore. This new demand is bringing new issues and challenges and it is important for companies to scale for the coming growth. And with that scaling comes the need for greater security, gathering and data analysis, storage, connectivity and, of course, the...
Apr. 29, 2016 08:45 AM EDT Reads: 601