---
# System prepended metadata

title: <center><i class="fa fa-edit"></i> gNB configuration (installation of source code) </center>

---

:::warning
# <center><i class="fa fa-edit"></i> gNB configuration (installation of source code) </center>
:::



[TOC]

### gNB build and configuration
To get the code and build the gNB executable:
```c=
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git

cd openairinterface5g/

git checkout develop

source oaienv

cd cmake_targets/
    
./build_oai -I #For OAI first time installation

/build_oai --gNB -w USRP
```
In the following, we highlight the fields of the file that have to be configured according to the configuration and interfaces of the Core Network. First, the PLMN section has to be filled with the proper values that match the configuration of the AMF and the UE USIM.

```c=
// Tracking area code, 0x0000 and 0xfffe are reserved values
    tracking_area_code  =  1;
    plmn_list = ({
			 mcc = 208;
			 mnc = 99;
			 mnc_length = 2;
			 snssaiList = (
			 {
				sst = 1;
				sd  = 0x1; // 0 false, else true
			 },
			 {
				 sst = 1;
				 sd  = 0x112233; // 0 false, else true
			 }
			);
		});
```
Then, the source and destination IP interfaces for the communication with the Core Network also need to be set as shown below.

```c=
    ////////// AMF parameters:
    amf_ip_address      = ( { ipv4       = "192.168.70.132";
                              ipv6       = "192:168:30::17";
                              active     = "yes";
                              preference = "ipv4";
                            }
                          );


    NETWORK_INTERFACES :
    {
        GNB_INTERFACE_NAME_FOR_NG_AMF            = "demo-oai";
        GNB_IPV4_ADDRESS_FOR_NG_AMF              = "192.168.70.129/24";
        GNB_INTERFACE_NAME_FOR_NGU               = "demo-oai";
        GNB_IPV4_ADDRESS_FOR_NGU                 = "192.168.70.129/24";
        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
    };
```
In the first part (amf_ip_address) we specify the IP of the AMF and in the second part (NETWORK_INTERFACES) we specify the gNB local interface with AMF (N2 interface) and the UPF (N3 interface).