Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- . "/etc/CFG_FULL.cfg"
- #while read IP
- #do
- IP=192.168.212.14
- rm $pwd/vlan/"$IP"_vlanid.txt
- ##vlan id gvrp
- $VARSNMPWALK -v2c -c $CommunityRO $IP 1.3.6.1.2.1.17.7.1.4.2.1.6 | grep "INTEGER: 3" | awk '{FS = "."; print $10}' | awk '{print $1}' | sort -n >> $pwd/vlan/"$IP"_vlanid.txt
- ##name
- while read VLANID
- do
- #VLANID=77
- NameVlan=$($VARSNMPWALK -v2c -c $CommunityRO 192.168.212.2 1.3.6.1.2.1.17.7.1.4.3.1.1.$VLANID | awk '{print $4}' | sed -e "s/\"//g")
- ##port
- PortHex=$($VARSNMPWALK -v2c -c $CommunityRO $IP 1.3.6.1.2.1.17.7.1.4.2.1.4 | grep "\.$VLANID =" | awk '{print $4,$5,$6,$7,$8,$9,$10,$11}' | sed 's/ //g')
- ##Create vlan
- #$VARSNMPSET -v2c -c $CommunityRW $IP 1.3.6.1.2.1.17.7.1.4.3.1.1.$VLANID $NameVlan 1.3.6.1.2.1.17.7.1.4.3.1.2.$VLANID x $PortHex
- $VARSNMPSET -v2c -c $CommunityRW $IP 1.3.6.1.2.1.17.7.1.4.3.1.1.$VLANID s "$NameVlan" \
- 1.3.6.1.2.1.17.7.1.4.3.1.2.$VLANID x $PortHex \
- 1.3.6.1.2.1.17.7.1.4.3.1.3.$VLANID x 0000000000000000 \
- 1.3.6.1.2.1.17.7.1.4.3.1.4.$VLANID x 0000000000000000 \
- 1.3.6.1.2.1.17.7.1.4.3.1.5.$VLANID i 4
- $VARSNMPSET -v2c -c $CommunityRW $IP 1.3.6.1.4.1.171.11.70.8.2.17.1.1.11.$VLANID i 3
- done < $pwd/vlan/"$IP"_vlanid.txt
- #done < $pwd/db_ip_test.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement