Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Last active September 29, 2023 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haproxytechblog/29ea04c3647b02f4aa5d468455b7baf2 to your computer and use it in GitHub Desktop.
Save haproxytechblog/29ea04c3647b02f4aa5d468455b7baf2 to your computer and use it in GitHub Desktop.
Extract Insightful Data From Proxy Protocol Packets Blog
tshark -disable-protocol tls -Y proxy.src.ipv4 -V
tshark -r FILENAME -Y proxy.src.ipv4
tshark -f "tcp port not 22" -a "duration:5"
curl --haproxy-protocol http://<your load balancer>/...
* Trying ::1:80...
* connect to ::1 port 80 failed: Connection refused
* Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> PROXY TCP4 127.0.0.1 127.0.0.1 53606 80
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< content-length: 0
< location: /hapee-stats
< cache-control: no-cache
<
* Connection #0 to host localhost left intact
sudo yum install wireshark
sudo apt-get install tshark
ubuntu@bk:/etc/hapee-2.6# tshark -Y proxy.src.ipv4 -V
...
PROXY Protocol
Magic: 0d0a0d0a000d0a515549540a
0010 .... = Version: 2
.... 0001 = Command: 1
[Version: 2]
Address Family Protocol: TCP over IPv4 (0x11)
0001 .... = Address Family: IPv4 (0x1)
.... 0001 = Protocol: 0x1
Length: 12
Source Address: 192.168.64.1
Destination Address: 192.168.64.120
Source Port: 49344
Destination Port: 8081
tshark -r FILENAME -Y proxy.src.ipv4 -V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment