# DHCP Relay through GRE-Bridge

> DHCP relay through GRE tunnel with bridge on VyOS - centralized DHCP server deployment across remote sites, configuration example and traffic flow diagram

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


DHCP relay through a GRE tunnel for a centralized DHCP server serving a remote location.

## Scenario

- Centralized DHCP: DHCP server in the datacenter
- Remote Sites: branch offices relay DHCP through the 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 to the 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 at 10.100.1.53 with a scope for the 10.10.1.0/24 branch subnet.

## References

- [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)

