Abhishek dot py
Abhishek dot py

Reputation: 939

Haproxy: Need to know all Incoming IP's

I have two web servers running with One load balancer with Haproxy. I need to block IP's that are coming to my load balancer more than often. How do I check all the incoming IP's? Is there a log?

Upvotes: 2

Views: 3745

Answers (2)

Matt Beckman
Matt Beckman

Reputation: 5012

If you want to see the established connections on a Linux server, use this command (via SSH):

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head -n 10

If you want to log more verbose HAProxy activity, use this setting in haproxy.cfg:

log 127.0.0.1 local0 info

You can view the more verbose output in /var/log/haproxy_0.log

Upvotes: 2

Gregosaurus
Gregosaurus

Reputation: 611

You should try this :

echo 'Client IP: '.$_SERVER["REMOTE_ADDR"];
echo 'Client IP: '.$_SERVER["HTTP_CLIENT_IP"];

These commands displays loadbalancer's IP. More at : https://serverfault.com/a/331909

Upvotes: 0

Related Questions