BGP: حماية الجلسات بالـ Password و TTL Security

جارٍ التحميل…

BGP: حماية الجلسات بالـ Password و TTL Security

جلسة BGP مع المزوّد هي باب الشركة للإنترنت، وأي أحد يقدر يرسل TCP reset مزيّف أو يحاول يفتح جلسة. نطبّق neighbor password اللي يضيف MD5 على كل packet في الـ TCP، ونشوف الجلسة تطيح لما طرف واحد بس مفعّل، وبعدها ttl-security اللي يرفض أي packet جاية من أبعد من hop وحدة.

ضمن مسار ENARSI 300-410 — التوجيه المتقدم وخدمات الشبكات

شرح الدرس مكتوبًا

نص شرح المعلم والكود الذي كتبه ونتيجة تشغيله، بنفس ترتيب الدرس.

R1
enable
configure terminal
hostname R1
no ip domain-lookup
interface g0/0/0
ip address 10.0.12.1 255.255.255.0
no shutdown
interface g0/0/1
ip address 10.0.14.1 255.255.255.0
no shutdown
interface lo0
ip address 1.1.1.1 255.255.255.255
interface lo1
ip address 172.16.1.1 255.255.255.0
ip ospf network point-to-point
end
enable
configure terminal
router ospf 1
router-id 1.1.1.1
network 10.0.12.0 0.0.0.255 area 0
network 1.1.1.1 0.0.0.0 area 0
end
enable
configure terminal
router bgp 65001
bgp router-id 1.1.1.1
neighbor 10.0.14.4 remote-as 65003
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source lo0
neighbor 2.2.2.2 next-hop-self
network 172.16.1.0 mask 255.255.255.0
end
R2
enable
configure terminal
hostname R2
no ip domain-lookup
interface g0/0/0
ip address 10.0.12.2 255.255.255.0
no shutdown
interface g0/0/1
ip address 10.0.23.2 255.255.255.0
no shutdown
interface lo0
ip address 2.2.2.2 255.255.255.255
interface lo1
ip address 172.16.2.1 255.255.255.0
ip ospf network point-to-point
end
enable
configure terminal
router ospf 1
router-id 2.2.2.2
network 10.0.12.0 0.0.0.255 area 0
network 2.2.2.2 0.0.0.0 area 0
end
enable
configure terminal
router bgp 65001
bgp router-id 2.2.2.2
neighbor 10.0.23.3 remote-as 65002
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source lo0
neighbor 1.1.1.1 next-hop-self
network 172.16.2.0 mask 255.255.255.0
end
R3
enable
configure terminal
hostname R3
no ip domain-lookup
interface g0/0/0
ip address 10.0.23.3 255.255.255.0
no shutdown
interface g0/0/1
ip address 10.0.34.3 255.255.255.0
no shutdown
interface lo0
ip address 3.3.3.3 255.255.255.255
interface lo1
ip address 203.0.113.1 255.255.255.0
end
enable
configure terminal
router bgp 65002
bgp router-id 3.3.3.3
neighbor 10.0.23.2 remote-as 65001
neighbor 10.0.34.4 remote-as 65003
network 203.0.113.0 mask 255.255.255.0
end
R4
enable
configure terminal
hostname R4
no ip domain-lookup
interface g0/0/0
ip address 10.0.34.4 255.255.255.0
no shutdown
interface g0/0/1
ip address 10.0.14.4 255.255.255.0
no shutdown
interface lo0
ip address 4.4.4.4 255.255.255.255
interface lo1
ip address 198.51.100.1 255.255.255.0
end
enable
configure terminal
router bgp 65003
bgp router-id 4.4.4.4
neighbor 10.0.14.1 remote-as 65001
neighbor 10.0.34.3 remote-as 65002
network 198.51.100.0 mask 255.255.255.0
end

حيّاك الله. جلسة BGP هي TCP عادي على البورت one seventy nine. يعني أي هجوم على TCP يقدر يطيّحها: packet reset مزيّفة تقطع الجلسة، وكل المسارات تختفي، والشركة تطلع من الإنترنت. وفي ENARSI أداتين أساسيتين للحماية: الـ password، والـ TTL security.

الأولى: neighbor password. تضيف توقيع MD5 على كل packet TCP في الجلسة. وأي packet بدون توقيع صحيح ينرمى قبل ما يوصل لـ BGP، حتى الـ reset المزيّفة. والثانية: neighbor ttl-security hops واحد. الجار المباشر يرسل الـ packets بـ TTL two fifty five، فتوصل بـ two fifty four بعد hop وحدة. والراوتر يرفض أي packet الـ TTL حقها أقل. يعني مهاجم بعيد ما يقدر يوصل، حتى لو زوّر العنوان. نبدأ بالـ password على R1، للجار R4، وما نكمل الطرف الثاني، ونشوف.

R1
configure terminal
router bgp 65001
neighbor 10.0.14.4 password Basma123
end
clear ip bgp 10.0.14.4
show ip bgp summary | begin Neighbor

الجلسة مع R4 صارت Active، يعني تحاول وتفشل. والراوتر طلّع رسالة: TCP BADAUTH، No MD5 digest. يعني R4 يحاول يفتح TCP بدون توقيع، و R1 يتوقع توقيع، فيرمي الـ packet قبل ما توصل BGP أصلاً. ولو الكلمتين مختلفتين، الرسالة تقول Invalid MD5 digest. نكمل الطرف الثاني على R4، بنفس الكلمة بالضبط.

R4
configure terminal
router bgp 65003
neighbor 10.0.14.1 password Basma123
end
R1
show ip bgp summary | begin Neighbor

الجلسة رجعت Established. وانتبه: تغيير الـ password على جلسة قايمة ما يقطعها فوراً، لأن الـ TCP مفتوح. المشكلة تطلع بعدين، لما الجلسة تنقطع لأي سبب، وما ترجع. وهذا فخ في التشخيص: جلسة طاحت بعد صيانة، والسبب password تغيّر من أسابيع. عشان كذا سوينا clear بعد التغيير. الحين دورك. فعّل ttl-security hops واحد على جلسة R2 مع R3، على الطرفين، وتأكد إن الجلسة للحين Established. وفكّر: ليش لازم الطرفين؟ وقّف الفيديو، وجرّب.

تمرين: على R2: neighbor 10.0.23.3 ttl-security hops 1. وعلى R3: neighbor 10.0.23.2 ttl-security hops 1. بعدها show ip bgp summary على R2.

الحل.

R2
configure terminal
router bgp 65001
neighbor 10.0.23.3 ttl-security hops 1
end
show ip bgp summary | begin Neighbor
R3
configure terminal
router bgp 65002
neighbor 10.0.23.2 ttl-security hops 1
end

الجلسة Established. ولازم الطرفين، لأن كل طرف لازم يرسل بـ TTL two fifty five، عشان الثاني يقبل. لو طرف واحد بس، يرسل بـ TTL واحد الافتراضي حق eBGP، والثاني يرفضه. الخلاصة: password يحمي الـ TCP بـ MD5 على الطرفين، و ttl-security يرفض البعيد، وما يجتمع مع ebgp-multihop. والدرس الجاي: BGP مع IPv6.

دروس المسار (74)
  1. حيّاكم الله: من ENCOR إلى ENARSI
  2. كيف يختار الراوتر المسار: Longest Match و Administrative Distance
  3. الـ Prefix List: فلترة بالشبكة وبطول الـ prefix
  4. الـ Route Map: لغة السياسات في التوجيه
  5. الـ Distribute List: الفلترة في EIGRP وفي OSPF
  6. الـ Redistribution: ربط EIGRP مع OSPF
  7. مشاكل الـ Redistribution في أكثر من نقطة: Tags تمنع الـ Loop
  8. الـ Summarization: مسار واحد بدل أربعة، و Null0
  9. منع الـ Loops: Split Horizon و Route Poisoning
  10. الـ Policy Based Routing: توجيه حسب المصدر
  11. الـ VRF-Lite: أكثر من Routing Table في راوتر واحد
  12. الـ BFD: اكتشاف العطل في جزء من الثانية
  13. تشخيص أعطال التوجيه: طريقة منظمة على شبكة خربانة
  14. EIGRP: شروط الجيرة وتشخيص الجار اللي ما يطلع
  15. EIGRP: الـ Metric بالأرقام، وكيف تتحكم في المسار
  16. EIGRP: الـ DUAL و الـ Feasible Successor
  17. EIGRP Named Mode: كل الإعدادات في مكان واحد
  18. EIGRP: الـ Variance و Unequal-Cost Load Balancing
  19. EIGRP Stub: حماية الشبكة من الـ Queries
  20. EIGRP: الـ Leak-Map والـ Offset-List
  21. EIGRP: الـ Authentication بـ MD5 و SHA-256
  22. EIGRP for IPv6: الـ Classic والـ Named
  23. تشخيص EIGRP: ثلاث مشاكل في طريق واحد
  24. OSPF: حالات الجيرة، و Hello، و MTU
  25. OSPF: أنواع الشبكات و الـ DR و الـ BDR
  26. OSPF: أنواع الـ LSAs وقراءة الـ Database
  27. OSPF: ترتيب تفضيل المسارات وقاعدة الـ Backbone
  28. OSPF: الـ Stub و Totally Stubby Areas
  29. OSPF: الـ NSSA و LSA النوع سبعة
  30. OSPF: التلخيص في الـ ABR والـ ASBR
  31. OSPF: الفلترة الصحيحة بين الـ Areas
  32. OSPF: الـ Virtual Link لـ Area مفصولة
  33. OSPF: الـ Cost والـ Reference Bandwidth
  34. OSPF: الـ Authentication بـ MD5 و SHA
  35. OSPFv3: الـ OSPF حق IPv6
  36. تشخيص OSPF: جيران ما يطلعون
  37. BGP: الجلسات وحالاتها
  38. BGP: الـ iBGP بين الـ Loopbacks
  39. BGP: الـ Next Hop في الـ iBGP و next-hop-self
  40. BGP: الـ Route Reflector بدل الـ Full Mesh
  41. BGP: خوارزمية اختيار أفضل مسار
  42. BGP: التحكم في الترافيك الطالع بالـ Weight والـ Local Preference
  43. BGP: التحكم في الترافيك الداخل بالـ AS Path Prepend والـ MED
  44. BGP: الفلترة بالـ Prefix List وخطر الـ Transit
  45. BGP: الـ Regular Expressions و AS Path Filter
  46. BGP: الـ Communities و no-export
  47. BGP: حماية الجلسات بالـ Password و TTL Security
  48. MP-BGP: BGP لـ IPv6 بالـ Address Families
  49. تشخيص BGP: جلسات واقعة ومسار مو valid
  50. MPLS و LDP: Core بدون BGP
  51. MPLS Layer 3 VPN: الـ VRF و RD و RT و VPNv4
  52. تشخيص MPLS VPN: من الـ Core لفوق
  53. DMVPN: الـ mGRE و NHRP
  54. DMVPN: التوجيه فوق النفق و Phase 2
  55. DMVPN: الـ Phase 3 والحماية بـ IPsec
  56. AAA: TACACS+ و RADIUS وتشخيص الدخول
  57. الـ ACLs: الترتيب، والـ Sequence Numbers، والمكان الصح
  58. الـ Time-Based ACL: صلاحيات حسب الوقت
  59. الـ ACLs في IPv6 وفخ الـ Neighbor Discovery
  60. الـ uRPF: الحماية من العناوين المزوّرة
  61. الـ CoPP: حماية الـ Control Plane
  62. حماية الـ Management Plane: SSH و Access-Class
  63. IPv6 First-Hop Security: RA Guard و DHCPv6 Guard و Source Guard
  64. الدخول على الأجهزة والـ Backup بـ TFTP
  65. SNMP: من v2c المكشوف إلى SNMPv3
  66. الـ Syslog: مستويات الخطورة ووين تروح الرسائل
  67. الـ Debug بشرط: بدون ما تغرق الراوتر
  68. DHCP و الـ Relay: تشخيص أجهزة ما تاخذ عنوان
  69. DHCPv6: Stateful و Stateless والـ Relay
  70. الـ IP SLA و Object Tracking: Failover ذكي بين مزوّدين
  71. الـ Flexible NetFlow: مين يتكلم مع مين
  72. Catalyst Center Assurance: التشخيص من لوحة وحدة
  73. مشروع التشخيص الكامل: الشركة طاحت من الإنترنت
  74. الخاتمة: الاستعداد لاختبار ENARSI و وش بعده