前两天出去面试,技术准备叉了,面的网络岗,准备了些乱七八糟的东西,把ospf、bgp忘得差不多了。回来敲了一遍GNS3模拟器,顺道把之前想画的OSPF拓扑图琢磨了一下。之前通过LLDP、BGP画过拓扑,觉得问题不大。
OPSF 几种LSA
1.router lsa
2.network lsa
3.network summary lsa
4.ASBR summary lsa
5.AS external LSA
6.gourp membership lsa
7.nssa external lsa
其实通过前两种LSA 就可以构建出本区域的拓扑关系,通过3可以知道abr是谁,通过abr可以找到邻接区域的拓扑关系,这样整个ospf区域的拓扑关系就可以找到。
信息采集用php和shell都实现了一下。觉得shell的效率要高一些
declare -a hosts;
hosts[0]=$host;
function getNbrId(){
echo "run getNbrId function....";
nbrIds=`snmpwalk -v 2c -c $COMMUNITY $1 1.3.6.1.2.1.14.10.1.3 | awk '{print $NF}'`;
for nbrId in ${nbrIds[*]}
do
exist=0;
echo "nbrid: $nbrId";
for ip in ${hosts[*]}
do
if [ $nbrId == $ip ];then
exist=1;
fi
done
if [ $exist == 0 ];then
arrN=`expr ${#hosts[@]}`;
echo $arrN;