Is it possible with bgp to not advertise a single ip address in a /24 when my peer will not accept less than a /24? We had a udp flood attack on a single customer and lost the network. My router successfully started blocking the packets, but it did us no good as our entire 1gig fiber had maxed out and it killed everybody. I had to take that particular /24 out until the attack stopped to keep most of the network online.
Read other postings on the forum.
You can send a single IP to your upstream provider with an agreed community value and they will null-route the IP.
You need to discuss this with your upstream provider and implement a script shown elsewhere.
Ok my provider set me up so I can send communities along with a /32 IP address in order to black hole a single IP. I’ve been reading the wiki for the last couple of days and I’m missing something as I cannot get this to work. If I edit my BGP peer and add an Out-Filter that I called BGP-Out I stop advertising all of my subnets. Even if I do not have any route filters setup yet. I’m not sure why this is? Do these not work similar to firewall filters? I then tried creating route filters that accept the subnets that I wanted to send but I still do not advertise anything at all if that Outfilter is present.
Can someone point me to a basic example? The wiki hurts my brain.
Ok, I got past that first hurdle. I found that when I added the BGP-Out filter to the Peer the routes would stop advertising until I disabled the peer and re-enabled it, then it worked fine.
I then added a single filter with a single IP address and I am showing that I am advertising it with the new community, but I can still ping that address from outside of my network. Did I miss something or did my provider miss something?
Multihop being set right/wrong will cause eBGP neighbors to form adjacencies / fail to form adjacencies.
If the session goes up then you’re set properly in that regard.
Realize that the filter only allows something to be advertised, but it has nothing to do with what goes into your BGP table.
You need to put the blackholed address into your BGP - the easiest way is to define it as a /32 network in the BGP configuration, and for this particular task (black hole routing), you can just un-check the “synchronize” checkbox so that the network is always inserted into BGP regardless of whether that exact prefix appears in the IP routing table.
Check what advertisements you’re sending to the peer by looking in the Advertisements tab and make sure that you’re sending the /32 blackhole prefix to the provider.
This tab only shows what is actually sent to a peer so if your /32 is not shown, then your router didn’t send the prefix to the peer.
The nexthop field is pretty irrelevant for a blackhole route because the provider is going to see the blackhole community and modify the nexthop on their end to be a black hole destination.
I failed to mention it, but yes I also have that IP advertised in my BGP session as a /32. In my advertisements list it shows up and has the community value in it. So it should be working right? But I can still ping it from outside of my network. I’ve emailed my provider to check their config, but in the meantime does it sound like I’ve done it properly?
I’ve been reading through the forums and various options to automate this and see mentions of scrips, but cannot find the script. I already have firewall rules in place that will detect and stop the attack, but how can I write a script that will take that address list and add it to the bgp route filter and advertise list?
I use this for detecting attacks and dropping them. I found this on this forum somewhere a long time ago. Someone else deserves the credit I just don’t recall where I found it. It works really well, during an attack it does start dropping the packets and expires after 10 minutes if the attack is over. As long as you have the bandwidth to survive it that is.
;;; Jump New Syn Connections to Forward Syn Protect Chain
chain=forward action=jump jump-target=Forward Syn Protect connection-state=new log=no log-prefix=“”
;;; Limit New Forward Connections to 50/sec Per Destination IP
chain=Forward Syn Protect action=return connection-state=new dst-limit=50,50,src-and-dst-addresses/10s log=no log-prefix=""
;;; Add SYN Flood Victims to Address List for 10 Mins
Be very very very careful if you’re going to have an automated black hole function.
The automated black hole itself could be used as a DDoS vector without the need for any botnet -
The firewall rules you posted don’t require any amount of bandwidth consumption to be considered an attack - just number of connections/sec.
(and they also include UDP, even though the rules are labeled as SYN rules in their comments)
So I could just port scan a host over and over, and if it gets thrown into a black hole because I port scanned it… well, I hope the problem is obvious.
If they decided to do this to your DNS server, for instance, then you’d be having a very bad day indeed.