# DHCP Relay through GRE-Bridge

> Ретрансляция DHCP через GRE-туннель с мостом на VyOS - централизованный DHCP-сервер для удаленных площадок, пример конфигурации и схема трафика.

Source: https://opennix.org/docs/vyos/examples/dhcp-relay-gre/


DHCP relay через GRE tunnel для centralized DHCP server в remote location.

## Сценарий

- Centralized DHCP: DHCP server в datacenter
- Remote Sites: Branch offices relay DHCP через tunnel
- Service Provider: Aggregation site DHCP

## Topology

```
Branch Office          GRE Tunnel          Datacenter
   (VyOS)      ════════════════════►      (DHCP Server)
Client DHCP      DHCP Relay               10.100.1.53
Request
```

## VyOS Branch Configuration

```bash
# GRE Tunnel к datacenter
set interfaces tunnel tun0 address '172.16.0.2/30'
set interfaces tunnel tun0 encapsulation 'gre'
set interfaces tunnel tun0 source-address '198.51.100.1'
set interfaces tunnel tun0 remote '203.0.113.1'

# Bridge (LAN + GRE tunnel)
set interfaces bridge br0 member interface eth1
set interfaces bridge br0 member interface tun0
set interfaces bridge br0 address '10.10.1.1/24'

# DHCP Relay
set service dhcp-relay interface 'br0'
set service dhcp-relay server '10.100.1.53'
set service dhcp-relay relay-options relay-agents-packets 'forward'

commit
```

## Datacenter DHCP Server

DHCP server на 10.100.1.53 с scope для 10.10.1.0/24 branch subnet.

## Ссылки

- [VyOS DHCP Relay](https://docs.vyos.io/en/latest/configuration/service/dhcp-relay.html)
- [VyOS GRE Example](https://docs.vyos.io/en/latest/configexamples/autotest/DHCPRelay_through_GRE/DHCPRelay_through_GRE.html)

