> For the complete documentation index, see [llms.txt](https://adavyshin.gitbook.io/networks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adavyshin.gitbook.io/networks/docs/dhcp-snooping-i-dai.md).

# DHCP Snooping и DAI

### 🧪 DHCP Snooping

🧭 Работаем внутри сети Headquarter, в частности на коммутаторе <kbd>HQ-SWITCH</kbd> и неавторизованный DHCP-сервер <kbd>ROGUE-DHCP</kbd>.&#x20;

🔧 Включаем DHCP Snooping на коммутаторе <kbd>HQ-SWITCH</kbd>

```
ip dhcp snooping vlan 1
ip dhcp snooping database flash0:dhcp-snopping.db
ip dhcp snooping
```

🔧 Настраиваем доверенный порт на коммутаторе <kbd>HQ-SWITCH</kbd>

```
interface GigabitEthernet3/3
  ip dhcp snooping trust
```

Но есть нюанс, связанный с дефолтной работой DHCP Snooping, коммутатор имеет свойство проставлять `Option 82` в `DHCPDISCOVER` сообщениях, а DHCP-сервер на маршрутизаторе HQ-ROUTER не захочет признавать эти `DISCOVER` и за-за не корректного поля.

<figure><img src="/files/ybwB5APItzN4z9IEw68l" alt=""><figcaption></figcaption></figure>

🔧 Отключаем добавления `Option 82` на <kbd>HQ-SWITCH</kbd>:

```
no ip dhcp snooping information option
```

🔌Активируем <kbd>ROGUE-DHCP</kbd>&#x20;

```
configure terminal
!
interface Ethernet0/0
  no sh
```

### 🧪Dynamic ARP Inspection (DAI)

🧭 Продолжаем работать внутри сети Headquarter, в частности на коммутаторе <kbd>HQ-SWITCH</kbd> и задействуем VM <kbd>HQ-MGMT</kbd>.  Креды от VM  `john` / `Pa$$w0rd`

Давайте посмотрим на картину до того применим защитные механизмы, что показать как работает MITM-атака мы сделаем ARP-инъекции с тестовой машины <kbd>HQ-MGMT</kbd>.

🐧Отравляем ARP-кэш для двух устройств и осуществляем MITM на <kbd>HQ-MGMT</kbd>

```bash
sudo arpspoof -i ens3 -t 172.16.1.10 172.16.1.254 -r
```

🔎 Давайте посмотрим, что же происходит на интерфейсе в сторону <kbd>HQ-MGMT</kbd> с помощью Wireshark

Для того, чтобы защититься от данной атаки нам необходимо настроить Dynamic ARP Inspection

```
ip arp inspection vlan 1
```

Настройка фильтра, где IP-адрес прибивается гвоздями к MAC

```
arp access-list VLAN1
  permit ip host <> mac host  
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adavyshin.gitbook.io/networks/docs/dhcp-snooping-i-dai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
