Advertisement
Izya12

IGMP.sh

Sep 11th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. #/bin/bash
  2. . "/etc/CFG_FULL.cfg"
  3. cd $pwd/igmp.v2
  4.  
  5. #nmap --excludefile $pwd/db_ip_exclude.txt -sn 192.168.212.0/22 | egrep -v "Host" | awk '{print $5}' > $pwd/db_ip_test.txt
  6. #nmap --excludefile $pwd/db_ip_agr_exclude.txt -sn 192.168.212.2-49 | egrep -v "Host" | awk '{print $5}' > $pwd/db_ip_agr.txt
  7.  
  8. # Коммутаторы доступа
  9. while read ip
  10. do
  11.  
  12. HW=$(/usr/local/bin/snmpget -v2c -c $CommunityRO $ip iso.3.6.1.2.1.16.19.3.0 | awk '{ print $4 }' | sed -e "s/\"//g")
  13.  
  14. ################################################################################################################################
  15.  
  16. if [ "$HW" = "C1" ]
  17. then
  18.  
  19. PORT=$(/usr/local/bin/snmpwalk -v2c -c $CommunityRO $ip iso.3.6.1.2.1.17.1.2.0 | awk '{print $4}')
  20.  
  21. if [ "$PORT" = "10" ]
  22. then
  23.  
  24. COMD1="config limited_multicast_addr ports 1-8 add profile_id 1"
  25. COMD2="config max_mcast_group ports 1-8 max_group 4"
  26. COMD3="config limited_multicast_addr ports 1-8 access permit"
  27.  
  28. $pwd/igmp.v2/comd_C1.sh "$ip" "$COMD1" "$COMD2" "$COMD3"
  29.  
  30. elif [ "$PORT" = "28" ]
  31. then
  32.  
  33. COMD1="config limited_multicast_addr ports 1-24 add profile_id 1"
  34. COMD2="config max_mcast_group ports 1-24 max_group 4"
  35. COMD3="config limited_multicast_addr ports 1-24 access permit"
  36.  
  37. $pwd/igmp.v2/comd_C1.sh "$ip" "$COMD1" "$COMD2" "$COMD3"
  38.  
  39. elif [ "$PORT" = "52" ]
  40. then
  41.  
  42. COMD1="config limited_multicast_addr ports 1-48 add profile_id 1"
  43. COMD2="config max_mcast_group ports 1-48 max_group 4"
  44. COMD3="config limited_multicast_addr ports 1-48 access permit"
  45.  
  46. $pwd/igmp.v2/comd_C1.sh "$ip" "$COMD1" "$COMD2" "$COMD3"
  47.  
  48. else
  49. echo "$ip PORT XZ"
  50. fi
  51.  
  52. else
  53.  
  54. echo "$ip to $HW"
  55.  
  56. fi
  57.  
  58. ################################################################################################################################
  59.  
  60. done < $pwd/db_ip_test.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement