
interfaces { xe-0/3/0 { description "UPLINK_IX: DATAIX XX.XX.XX.XX 255.255.252.0 (path XXX);"; flexible-vlan-tagging; native-vlan-id 20; encapsulation flexible-ethernet-services; unit 0 { encapsulation vlan-bridge; vlan-id 20; } } irb { unit 20 { description "DataIX route interface"; family inet { filter { # } address XX.XX.XX.XX/22; } } } } firewall { family bridge { filter ix_mac_filter { # } } } protocols { bgp { group dataix { # BGP } } } routing-instances { switch_dataix { description "DATAIX - prometey XX.XX.XX.XX 255.255.252.0"; instance-type virtual-switch; bridge-domains { switch_dataix_bridge { domain-type bridge; vlan-id 20; interface xe-0/3/0.0; routing-interface irb.20; forwarding-options { filter { input ix_mac_filter; } } } } } } root @ rt01> show bridge mac-table
MAC flags (S -static MAC, D -dynamic MAC, L -locally learned, C -Control MAC
SE -Statistics enabled, NM -Non configured MAC, R -Remote PE MAC)
Routing instance: switch_dataix
Bridging domain: switch_dataix_bridge, VLAN: 20
MAC MAC Logical NH RTR
address flags interface Index ID
00: 01: e8: a3: ed: 20 D, SE xe-0/3 / 0.0
00: 03: fe: 0a: ac: 00 D, SE xe-0/3 / 0.0
00: 04: 80: f4: bc: 00 D, SE xe-0/3 / 0.0
00: 04: 96: 51: ba: 84 D, SE xe-0/3 / 0.0
00: 04: 96: 52: 05: a4 D, SE xe-0/3 / 0.0
00: 04: 96: 52: 05: ea D, SE xe-0/3 / 0.0
00: 04: 96: 52: 06: 14 D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 13: a9 D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 14: 79 D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 17: 79 D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 52: 3e D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 5b: 26 D, SE xe-0/3 / 0.0
00: 04: 96: 6d: 6f: f0 D, SE xe-0/3 / 0.0
00: 04: 96: 7d: bf: 68 D, SE xe-0/3 / 0.0
00: 04: 96: 7d: f8: 99 D, SE xe-0/3 / 0.0
... And based on this data, you can create a filter that will count the number of packets that came from the MAC address to the server being attacked: filter ix_mac_filter {
term 00: 01: e8: a3: ed: 20 {
from {
source-mac-address {
00: 01: e8: a3: ed: 20/48;
}
ip-destination-address {
# address of the attacked server
}
}
then {
count 00: 01: e8: a3: ed: 20;
accept;
}
}
term 00: 03: fe: 0a: ac: 00 {
from {
source-mac-address {
00: 03: fe: 0a: ac: 00/48;
}
ip-destination-address {
# address of the attacked server
}
}
then {
count 00: 03: fe: 0a: ac: 00;
accept;
}
}
term other {
then {
count other;
accept;
}
} Judging by the documentation in the Juniper MX series routers, there is a limit of 1024 rules with the counter action, but we did not rest on this limit. We reset the state of the counters in this filter and after some time (1-2 minutes) we look at the result:root @ rt01> clear firewall filter ix_mac_filter root @ rt01> show firewall filter ix_mac_filter Filter: ix_mac_filter Counters: Name Bytes Packets 00: 01: e8: a3: ed: 20 142632382856 288079929 00: 02: 4a: 2f: a0: 1a 5159885 75880 00: 03: fe: 0a: ac: 00 14915791420 72085522 00: 04: 96: 6d: 6f: f0 2508125168 35985837 00: 04: 96: 7d: f8: 99 362692758 5352205 00: 04: 96: 82: 4d: 57 216046092 2851369 ...
Source: https://habr.com/ru/post/278613/
All Articles