In last tutorial to wireshark we saw how to capture packets using wireshark. In this tutorial we will have our look on how to filter them according to need. As told earlier wireshark is not only a sniffing tool it can also be used for testing protocol implementation and network monitoring, it does have lots of filters which many of us hardly ever use. So here we will discus only those filters which are mostly used.
Filtering by IP address:
Now suppose you want to filter all those packets where IP address 192.168.248.128 is present then you have to type following command in filters,
if you also want to filter packets holding IP address 184.108.40.206, then above command will be modified as,
ip.addr==192.168.248.128 && ip.addr==220.127.116.11
where && means AND. If you want to list packets which holds any one IP address from above then the same filter will be written as follows,
ip.addr==192.168.248.128 or ip.addr==18.104.22.168
You can use as many && and or, but keep in mind all commands in wireshark strictly follow mathematical set theory for filtering so you have to be accurate to filter packets.
If you want to filter packets where source IP is 22.214.171.124 and destination IP is 192.168.248.128 then you can specify filters as follows,
You can use && and or switches equally with any filter.
Filtering by ports and protocols:
To filter packets by protocols just type name of protocol in filter box. For example TCP, UDP, HTTP, SMTP etc. To add port to filter add name of protocol appended by port number, look at following example,
ip.dst== 192.168.248.128 && tcp.port=443
Above filter will list all packets from TCP port 443 for destination 192.168.248.128
Filtering by MAC address:
You can use following filter to list packets with specified MAC address.
Lastly before you specify new filter you have to clear previous filter, to do so press clear button after filtering box.