---
title: Device Connect to Controller
slug: controller-campus/device-connect-to-controller
description: Device Connect to Controller
createdAt: 2025-11-14T03:58:48.499Z
---

## <font color="#1d50a2">Switch</font>

### <font color="#1d50a2">Dynamically obtain the controller IP through the DHCP server</font>

All Asterfusion devices can act as DHCP clients. Under the factory default configuration, they will actively send DHCP request to obtain the management IP address and the controller IP address.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/uhScKNZKh2patQ__duHAi-20251202-081642.png)

To ensure that devices can obtain the controller IP through DHCP requests, the DHCP server must be capable of responding to the option 138 field. The following is a configuration example for the ISC-DHCP server:

:::BlockQuote
subnet 192.168.1.0 netmask 255.255.255.0 \{
&#x20; range 192.168.0.100 192.168.0.200;
&#x20; option routers 192.168.0.1;
&#x20; option subnet-mask 255.255.255.0;
&#x20; option capwap-ac-v4 "192.168.0.91";&#x20;

:::

**\[Description]**

192.168.0.91 is the IP address of the controller.
In this case, configure the DHCP server and DHCP Relay (if any) as needed. After the switch is powered on and the physical connections are completed, you can see the switch go online on the \[Devices] page of the controller.

### <font color="#1d50a2">Connect to Controller by Command Line</font>

If the DHCP server does not exist in the network, or the DHCP server cannot be configured with the controller address, the user can use the command **ucentral-client server \<A.B.C.D>** to configure the IP address of the controller on the switch so that the device can connect to the controller.

If the device uses out-of-band management and the management port belongs to VRF mgmt, users need to specify the VRF parameter when designating the management address, for example: **ucentral-client server \<A.B.C.D> vrf mgmt**.

The following is a sample configuration for switch:

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/b4wZ6F9DuXOhLi2L0wRUT-20251202-081726.png" size="50" width="484" height="390" position="center" showCaption="false"}

Connect to the controller using the out-of-band management port：

:::BlockQuote
sonic# config
sonic(config)# ucentral-client enable
sonic(config)# ucentral-client server 192.168.0.91 vrf mgmt
sonic(config)# interface mgmt 0
sonic(config-if-mgmt) ip address 192.168.0.20/24 192.168.0.91
sonic(config-if-mgmt) vrf mgmt
:::

Use in-band management to connect to the controller. Take the Ethernet49 port as an example：

:::BlockQuote
sonic# config
sonic(config)# ucentral-client enable
sonic(config)# ucentral-client server 192.168.0.91&#x20;
sonic(config)# interface ethernet 49
sonic(config-if-49)# ip address 192.168.0.20/24&#x20;
sonic(config-if-49)# exit
sonic(config)# ip route 0.0.0.0/0 192.168.0.91
:::

After the configuration is completed, you can see the switch go online on the **\[Devices]** page of the controller.

## <font color="#1d50a2">AP</font>

In the factory default configuration, the AP will actively send a DHCP request to request the management IP address and the controller IP address.

### <font color="#1d50a2">There is Already a n the Network</font>

If there is a DHCP server in the network and the configuration has been completed.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/FnHZvY6ggKK1Ck29cxqsE-20251202-081842.png" size="70" width="601" height="474" position="center" showCaption="false"}

Since the AP is not directly connected to the DHCP server, it is necessary to use the script function or directly enter the switch background to configure through the command line. Configure the VLAN broadcast domain on the switch device directly connected to the AP to broadcast the DHCP request of the AP to the DHCP server.
After entering the venue, click **\[Operation]** - **\[Script]** to enter the script editing view. Click the **\[+]** in the upper right corner to create a new script, and select the script type as Sonic-cli.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/ZICmpzUPx4voSlNk9xGiq-20251202-081919.png)

Script content:

:::BlockQuote
configure
interface ethernet 48
no router-interface&#x20;
exit
vlan 4010
exit
port-group ethernet 46-48
switchport access vlan 4010
exit&#x20;
interface vlan 4010
ip address dhcp-alloc
:::

After completing the configuration, click Save.
Enter the device view, select the switch connected to the AP, and click the **\[Actions]** - **\[Script]** button in the upper right corner. Select the script edited in the previous step, click **\[Next]** - **\[Start]**, and send the script to the switch.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/Ky6RPec5eIhD-eaG4gooo-20251202-082054.png)

### <font color="#1d50a2">There is no n the Network</font>

If there is no DHCP server in the network, you need to configure the switch to act as a DHCP server, assign management IP addresses to the APs, and inform them of the controller's IP address.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/ci8C3vG5jb-qzRUcBqnJf-20251202-082135.png" size="70" width="518" height="451" position="center" showCaption="false"}

After entering the venue, click **\[Operation]** - **\[Script]** to enter the script editing view. Click the **\[+]** in the upper right corner to create a new script, and select the script type as Sonic-cli.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/9wz8yEhH7OQXn9fJxOflj-20251202-083114.png)

Script content:

:::BlockQuote
configure
interface ethernet 48
no router interface
exit
&#x20;vlan 4020
exit
&#x20;port-group ethernet 46-48
switchport access vlan 4020
exit
&#x20;interface vlan 4020
ip address 192.168.0.1/24
dhcp select server
exit
&#x20;dhcp pool ap
address pool 192.168.0.100 192.168.0.200
lease-time 3000 6000
network 192.168.0.0 255.255.255.0
routers 192.168.0.1
capwap-ac 192.168.0.91

:::

Note: 192.168.0.91 is the IP address of the controller.

After completing the configuration, click Save.
Enter the device view, select the switch connected to the AP, and click the **\[Actions]** - **\[Script]** button in the upper right corner. Select the script edited in the previous step, click **\[Start]**, and send the script to the switch.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/KAFQKGk3A81-0BymAVWsZ-20251202-083302.png)

Users can also directly select custom scripts on the script running page shown in the picture, fill in script content or upload script files and run them directly on this page.

![](https://api.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/dd98c6qpRSGhJz8eXvha5-20251202-083445.png)

## <font color="#1d50a2">OLT Stick</font>

In its factory default configuration, the OLT Stick will actively send a DHCP request to obtain a management IP address and a controller IP address. Its online activation method is the same as that of APs.
