拓扑图如上所示,area2和area0没有直接连接,所以网络没有获得全拓扑,此时我们可以在abr上做virtual-link来讲area2和area0连接,以下是配置脚本:
system {
time-zone Asia/Shanghai;
root-authentication {
encrypted-password "$1$eb9tNUWo$gYal5nxLO7VdL4n6MrNDY1"; ## SECRET-DATA
}
login {
user olive {
uid 1000;
class super-user;
authentication {
encrypted-password "$1$T5KQ/SxD$i12MFkx8PNZTgoxJ5CS5G0"; ## SECRET-DATA
}
}
}
services {
ssh;
telnet;
web-management {
http;
}
}
}
logical-systems {
r1 {
interfaces {
em1 {
unit 12 {
vlan-id 12;
family inet {
address 10.0.4.5/30;
}
}
unit 13 {
vlan-id 13;
family inet {
address 10.0.4.14/30;
}
}
inactive: unit 15 {
vlan-id 15;
family inet {
address 172.30.25.2/30;
}
}
}
lo0 {
unit 1 {
family inet {
address 10.0.0.1/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.2 {
interface em1.12;
interface em1.13;
}
}
}
r2 {
interfaces {
em2 {
unit 21 {
vlan-id 12;
family inet {
address 10.0.4.6/30;
}
}
unit 23 {
vlan-id 23;
family inet {
address 10.0.4.2/30;
}
}
unit 24 {
vlan-id 24;
family inet {
address 10.0.4.10/30;
}
}
}
lo0 {
unit 2 {
family inet {
address 10.0.0.2/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.2 {
interface em2.21;
interface em2.24;
}
}
}
r3 {
interfaces {
em3 {
unit 31 {
vlan-id 13;
family inet {
address 10.0.4.13/30;
}
}
unit 32 {
vlan-id 23;
family inet {
address 10.0.4.1/30;
}
}
unit 34 {
vlan-id 34;
family inet {
address 10.0.2.5/30;
}
}
unit 35 {
vlan-id 35;
family inet {
address 10.0.2.2/30;
}
}
}
lo0 {
unit 3 {
family inet {
address 10.0.0.3/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.2 {
interface em3.31;
}
area 0.0.0.1 {
interface em3.35;
interface em3.34;
}
area 0.0.0.0 {
virtual-link neighbor-id 10.0.0.5 transit-area 0.0.0.1;//virtual-link只能在area0里面配置,neighbor-id指对端RID,transit-area指virtual-link要通过的area
}
}
}
r4 {
interfaces {
em4 {
unit 42 {
vlan-id 24;
family inet {
address 10.0.4.9/30;
}
}
unit 43 {
vlan-id 34;
family inet {
address 10.0.2.6/30;
}
}
unit 45 {
vlan-id 45;
family inet {
address 10.0.2.10/30;
}
}
}
lo0 {
unit 4 {
family inet {
address 10.0.0.4/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.2 {
interface em4.42;
}
area 0.0.0.1 {
interface em4.45;
interface em4.43;
}
area 0.0.0.0 {
virtual-link neighbor-id 10.0.0.5 transit-area 0.0.0.1;
}
}
}
r5 {
interfaces {
em5 {
unit 53 {
vlan-id 35;
family inet {
address 10.0.2.1/30;
}
}
unit 54 {
vlan-id 45;
family inet {
address 10.0.2.9/30;
}
}
unit 56 {
vlan-id 56;
family inet {
address 10.0.8.6/30;
}
}
unit 57 {
vlan-id 57;
family inet {
address 10.0.8.9/30;
}
}
}
lo0 {
unit 5 {
family inet {
address 10.0.0.5/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.1 {
interface em5.53;
interface em5.54;
}
area 0.0.0.0 {
virtual-link neighbor-id 10.0.0.4 transit-area 0.0.0.1;
virtual-link neighbor-id 10.0.0.3 transit-area 0.0.0.1;
interface em5.57;
interface em5.56;
}
}
}
}
r6 {
interfaces {
em6 {
unit 65 {
vlan-id 56;
family inet {
address 10.0.8.5/30;
}
}
unit 67 {
vlan-id 67;
family inet {
address 10.0.8.1/30;
}
}
}
lo0 {
unit 6 {
family inet {
address 10.0.0.6/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.0 {
interface em6.65;
interface em6.67;
}
}
}
}
r7 {
interfaces {
em7 {
unit 75 {
vlan-id 57;
family inet {
address 10.0.8.10/30;
}
}
unit 76 {
vlan-id 67;
family inet {
address 10.0.8.2/30;
}
}
}
lo0 {
unit 7 {
family inet {
address 10.0.0.7/32;
}
}
}
}
protocols {
ospf {
area 0.0.0.0 {
interface em7.75;
interface em7.76;
}
}
}
}
}
interfaces {
em0 {
unit 0 {
family inet {
address 192.168.1.254/24;
}
}
}
em1 {
vlan-tagging;
}
em2 {
vlan-tagging;
}
em3 {
vlan-tagging;
}
em4 {
vlan-tagging;
}
em5 {
vlan-tagging;
}
em6 {
vlan-tagging;
}
em7 {
vlan-tagging;
}
}
olive# run show ospf neighbor logical-system all
logical-system: r2
Address Interface State ID Pri Dead
10.0.4.5 em2.21 Full 10.0.0.1 128 34
10.0.4.9 em2.24 Full 10.0.0.4 128 34
-----
logical-system: r3
10.0.2.6 em3.34 Full 10.0.0.4 128 35
10.0.2.1 em3.35 Full 10.0.0.5 128 33
10.0.4.14 em3.31 Full 10.0.0.1 128 33
10.0.2.1 vl-10.0.0.5 Full 10.0.0.5 0 37
-----
logical-system: r1
10.0.4.6 em1.12 Full 10.0.0.2 128 36
10.0.4.13 em1.13 Full 10.0.0.3 128 31
-----
logical-system: r5
10.0.8.5 em5.56 Full 10.0.0.6 128 34
10.0.8.10 em5.57 Full 10.0.0.7 128 34
10.0.2.2 vl-10.0.0.3 Full 10.0.0.3 0 33
10.0.2.10 vl-10.0.0.4 Full 10.0.0.4 0 34
10.0.2.2 em5.53 Full 10.0.0.3 128 31
10.0.2.10 em5.54 Full 10.0.0.4 128 32
-----
logical-system: r4
10.0.2.5 em4.43 Full 10.0.0.3 128 39
10.0.2.9 em4.45 Full 10.0.0.5 128 37
10.0.4.10 em4.42 Full 10.0.0.2 128 35
10.0.2.9 vl-10.0.0.5 Full 10.0.0.5 0 38
-----
logical-system: r7
10.0.8.9 em7.75 Full 10.0.0.5 128 36
10.0.8.1 em7.76 Full 10.0.0.6 128 31
-----
logical-system: r6
10.0.8.6 em6.65 Full 10.0.0.5 128 34
10.0.8.2 em6.67 Full 10.0.0.7 128 33
-----
olive# run show ospf interface logical-system all
logical-system: r2
Interface State Area DR ID BDR ID Nbrs
em2.21 DR 0.0.0.2 10.0.0.2 10.0.0.1 1
em2.24 BDR 0.0.0.2 10.0.0.4 10.0.0.2 1
-----
logical-system: r3
em3.34 BDR 0.0.0.1 10.0.0.4 10.0.0.3 1
em3.35 BDR 0.0.0.1 10.0.0.5 10.0.0.3 1
em3.31 DR 0.0.0.2 10.0.0.3 10.0.0.1 1
vl-10.0.0.5 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1
-----
logical-system: r1
em1.12 BDR 0.0.0.2 10.0.0.2 10.0.0.1 1
em1.13 BDR 0.0.0.2 10.0.0.3 10.0.0.1 1
-----
logical-system: r5
em5.56 BDR 0.0.0.0 10.0.0.6 10.0.0.5 1
em5.57 BDR 0.0.0.0 10.0.0.7 10.0.0.5 1
vl-10.0.0.3 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1
vl-10.0.0.4 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1
em5.53 DR 0.0.0.1 10.0.0.5 10.0.0.3 1
em5.54 DR 0.0.0.1 10.0.0.5 10.0.0.4 1
-----
logical-system: r4
em4.43 DR 0.0.0.1 10.0.0.4 10.0.0.3 1
em4.45 BDR 0.0.0.1 10.0.0.5 10.0.0.4 1
em4.42 DR 0.0.0.2 10.0.0.4 10.0.0.2 1
vl-10.0.0.5 PtToPt 0.0.0.0 0.0.0.0 0.0.0.0 1
-----
logical-system: r7
em7.75 DR 0.0.0.0 10.0.0.7 10.0.0.5 1
em7.76 DR 0.0.0.0 10.0.0.7 10.0.0.6 1
-----
logical-system: r6
em6.65 DR 0.0.0.0 10.0.0.6 10.0.0.5 1
em6.67 BDR 0.0.0.0 10.0.0.7 10.0.0.6 1