[![](https://openthread.io/static/images/icon-github.svg)View source on GitHub](https://github.com/openthread/ot-docs/tree/main/site/en/guides/border-router/build-native.md)

> [!NOTE]
> **Note:** This page focuses on running OTBR in a native host environment. To run OTBR in a Docker environment, follow the [Setup
> (Docker) steps](https://openthread.io/guides/border-router/build-docker).

## Get OTBR code

On Raspberry Pi:

1. Install git:

       sudo apt install git

   <br />

2. Clone `ot-br-posix` from GitHub:

       git clone --recursive --depth=1 https://github.com/openthread/ot-br-posix

## Build and install OTBR

OTBR has two scripts that bootstrap and set up the Thread Border Router:

    cd ot-br-posix
    ./script/bootstrap
    INFRA_IF_NAME=wlan0 ./script/setup

OTBR works on both a Thread interface and infrastructure network interface (e.g. Wi-Fi/Ethernet) which is specified with `INFRA_IF_NAME`. The Thread interface is created by OTBR itself and named `wpan0` by default and the infrastructure interface has a default value of `wlan0` if `INFRA_IF_NAME` is not explicitly specified. If your Raspberry Pi is connected by an Ethernet cable, specify the Ethernet interface name (e.g. `eth0`):

    INFRA_IF_NAME=eth0 ./script/setup

The `otbr-agent` service is now enabled and will start upon reboot. To instead start the service immediately without rebooting, use the `server` script:

    ./script/server

Verify that the `otbr-agent` service is active:

    sudo service otbr-agent status
    ● otbr-agent.service - Border Router Agent
       Loaded: loaded (/lib/systemd/system/otbr-agent.service; enabled; vendor preset: enabled)
       Active: active (running) since Mon 2021-03-01 05:46:26 GMT; 2s ago
     Main PID: 2997 (otbr-agent)
        Tasks: 1 (limit: 4915)
       CGroup: /system.slice/otbr-agent.service
               └─2997 /usr/sbin/otbr-agent -I wpan0 -B wlan0 spinel+hdlc+uart:///dev/ttyACM0

    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Stop publishing service
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [adproxy] Stopped
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: PSKc is not initialized
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Check if PSKc is initialized: OK
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Initialize OpenThread Border Router Agent: OK
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Border router agent started.
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-CORE---: Notifier: StateChanged (0x00038200) [NetData PanId NetName ExtPanId]
    Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-PLAT---: Host netif is down

> [!NOTE]
> **Note:** If you receive an "InvalidArguments" error, make sure your RCP board is connected as `/dev/ttyACM0`. It happens that the device path may change to `/dev/ttyACM1` after flashing the RCP. Re-plugging the RCP should solve this.

## Edit the Radio URL path

The OTBR agent uses the `/etc/default/otbr-agent` configuration file for its
startup parameters. This file contains the `OTBR_AGENT_OPTS` variable, which
defines settings like the Radio URL. For example,
`spinel+hdlc+uart:///dev/ttyACM0`.

This configuration file is generated by CMake from the
[`otbr-agent.default.in`](https://github.com/openthread/ot-br-posix/blob/74794140358dc91fc697361205ba3882f310e8aa/src/agent/otbr-agent.default.in)
source file. It is then fed into the system service as the
[service start parameters](https://github.com/openthread/ot-br-posix/blob/74794140358dc91fc697361205ba3882f310e8aa/src/agent/otbr-agent.service.in#L8-L9).

To change the Radio URL path on your target system:

1. Open the OTBR agent configuration file in a text editor:

       sudoedit /etc/default/otbr-agent

   <br />

2. Locate the `OTBR_AGENT_OPTS` variable.

3. Locate the Radio URL portion of the string. For example, `spinel+hdlc+uart:///dev/ttyACM0`.

4. Change that string to your new path.

5. Save the file and exit the editor.

6. Restart the `otbr-agent` service to apply the changes:

       sudo systemctl restart otbr-agent

   <br />