> For the complete documentation index, see [llms.txt](https://netlabs.gitbook.io/juniper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://netlabs.gitbook.io/juniper/4-multiarea-ospf/nastroika-virtual-link/vybor-dr-i-bdr.md).

# Выбор DR и BDR

![Схема сети](https://1953625668-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFMJhMiVjTLWfbfC-S4%2F-MV7zLlC_89HV1a7BWoN%2F-MV7zVMuoCUSVws3VSmU%2F%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png?alt=media\&token=bd23f6f5-cc45-4539-9d4b-1b34ccf8224b)

Предположим, что мы ходим выбрать DR и BDR в Broadcast сети самостоятельно. Пусть DR будет Moon (Сейчас Venus), а BDR Earth (Сейчас Earth). Для этого необходимо настроить приоритет для интерфейса. Но, для начала посмотрим текущую ситуацию:

{% code title="root\@Moon#" %}

```
[edit]
root@Moon# run show ospf neighbor 
Address          Interface              State     ID               Pri  Dead
10.2.2.1         ge-0/0/0.0             Full      192.168.0.1      128    39
10.2.2.2         ge-0/0/0.0             Full      192.168.0.2      128    35
10.2.2.3         ge-0/0/0.0             2Way      192.168.0.3      128    36
10.2.2.201       ge-0/0/1.0             Full      192.168.0.5      128    36

[edit]
root@Moon# run show ospf interface   
Interface           State   Area            DR ID           BDR ID          Nbrs
ge-0/0/0.0          DRother 0.0.0.2         192.168.0.1     192.168.0.2        3
ge-0/0/1.0          PtToPt  0.0.0.2         0.0.0.0         0.0.0.0            1
lo0.0               DRother 0.0.0.2         0.0.0.0         0.0.0.0            0
```

{% endcode %}

Из вывода команд следует, что роутер Moon сейчас не является ни BDR ни DR. Также стоит обратить внимание на состояние соседа&#x20;

{% code title="root\@Moon#" %}

```
10.2.2.3         ge-0/0/0.0             2Way      192.168.0.3      128    36
```

{% endcode %}

Состояние 2Way говорит о том, что сосед не является DR или BDR.

На DR и BDR же смежность установлена со всеми роутерами:

```
root@Venus# run show ospf neighbor 
Address          Interface              State     ID               Pri  Dead
10.2.2.4         ge-0/0/0.0             Full      192.168.0.4      128    33
10.2.2.3         ge-0/0/0.0             Full      192.168.0.3      128    39
10.2.2.2         ge-0/0/0.0             Full      192.168.0.2      128    32
```

Поставим приортитет Moon = 200, а Earth = 150:

```
root@Earth# set protocols ospf area 2 interface ge-0/0/0.0 priority 150 
root@Moon# set protocols ospf area 2 interface ge-0/0/0 priority 200 
```

Как видно, ситуация не изменилась:

```
root@Moon# run show ospf neighbor      
Address          Interface              State     ID               Pri  Dead
10.2.2.1         ge-0/0/0.0             Full      192.168.0.1      128    37
10.2.2.2         ge-0/0/0.0             Full      192.168.0.2      150    31
10.2.2.3         ge-0/0/0.0             2Way      192.168.0.3      128    38
10.2.2.201       ge-0/0/1.0             Full      192.168.0.5      128    35

[edit]
root@Moon# run show ospf interface   
Interface           State   Area            DR ID           BDR ID          Nbrs
ge-0/0/0.0          DRother 0.0.0.2         192.168.0.1     192.168.0.2        3
ge-0/0/1.0          PtToPt  0.0.0.2         0.0.0.0         0.0.0.0            1
lo0.0               DRother 0.0.0.2         0.0.0.0         0.0.0.0            0
```

Так происходит только потому что перевыбор DR и BDR происходит только после их падения.&#x20;

```
root@Venus# run request system halt
```

Теперь мы видим, что произошёл перевыбор DR и BDR. Теперь всё верно:

```
root@Moon# run show ospf interface   
Interface           State   Area            DR ID           BDR ID          Nbrs
ge-0/0/0.0          BDR     0.0.0.2         192.168.0.2     192.168.0.4        3
ge-0/0/1.0          PtToPt  0.0.0.2         0.0.0.0         0.0.0.0            1
lo0.0               DRother 0.0.0.2         0.0.0.0         0.0.0.0            0

root@Moon# run show configuration interfaces lo0 
unit 0 {
    family inet {
        address 192.168.0.4/32;
    }
}

root@Earth# run show configuration interfaces lo0 
unit 0 {
    family inet {
        address 192.168.0.2/32;
    }
}
```
