Skip to content

Xn Handover

Caution

  1. Do not start the two gNBs on the same machine, as this will cause a GTP port conflict.
  2. Do not start the UE on the same machine as free5GC, as this will cause data plane forwarding failures.

There are two options for deployment:

  • Use separate machines.
  • Use namespace separation. For details, please refer to Namespace.

Note

  • Xn handover is triggered from the console. The source gNB prepares the target gNB over the Xn interface, the UE moves its control plane and data plane to the target gNB, and the target gNB sends the Path Switch Request to the AMF.
  • Only a UE in single connection can be handed over. Turn off DC of the UE before handover.
  • Any online gNB with Xn enabled can be selected as the target gNB. The console gets the Xn address (xnListenIp / xnListenPort) of the target gNB and passes it to the source gNB. Handover does not use xnDialIp / xnDialPort of the configuration, which are only for static NR-DC.

A. Prerequisites

  • Golang:

    • free-ran-ue is built, tested and run with go1.26.2 linux/amd64
    • If Golang is not installed on your system, please execute the following commands:

      • Install Golang:

        Bash
        wget https://dl.google.com/go/go1.26.2.linux-amd64.tar.gz
        sudo tar -C /usr/local -zxvf go1.26.2.linux-amd64.tar.gz
        mkdir -p ~/go/{bin,pkg,src}
        # The following assume that your shell is bash:
        echo 'export GOPATH=$HOME/go' >> ~/.bashrc
        echo 'export GOROOT=/usr/local/go' >> ~/.bashrc
        echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc
        echo 'export GO111MODULE=auto' >> ~/.bashrc
        source ~/.bashrc
        
      • Check Installation. You should see the version information:

        Bash
        go version
        
    • If another version of Golang is installed, please execute the following commands to replace it:

      Bash
      sudo rm -rf /usr/local/go
      wget https://dl.google.com/go/go1.26.2.linux-amd64.tar.gz
      sudo tar -C /usr/local -zxvf go1.26.2.linux-amd64.tar.gz
      source $HOME/.bashrc
      go version
      
  • Node.js

    • free-ran-ue's console is built, test and run with node v20.19.2 / yarn v1.22.22.
    • If node and yarn is not installed on your system, olease execute the following commands:

      • Install node and yarn:

        Bash
        curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - 
        sudo apt update
        sudo apt install -y nodejs
        sudo corepack enable
        
      • Check Installation. You should see the version information:

        Bash
        node -v
        yarn -v
        

B. Clone and Build free-ran-ue

  • Clone

    Bash
    git clone https://github.com/free-ran-ue/free-ran-ue.git
    
  • Build

    Bash
    cd free-ran-ue
    make all
    

    After building, a binary executable file and frontend static files will be generated in the build folder.

C. Start gNBs

  • Modify the configuration file for gNBs:

    The configuration YAML file template is located at:

    • free-ran-ue/config/gnb-ho-1.yaml
    • free-ran-ue/config/gnb-ho-2.yaml

    Ensure that the information matches your core network settings. For core network settings, please refer to: Start free5GC

    Please also pay attention to the xnInterface section. The xnListenIp / xnListenPort is the Xn address of the gNB, which the source gNB dials when the gNB is selected as the target gNB. It should be an address reachable from the other gNBs, not 0.0.0.0.

    Also noticed the fields staticNrdc that should be set as false.

  • Start gNB:

    After configuring the YAML file, execute the binary in the build folder to start gNBs with the specified configuration file:

    • gNB-ho-1:

      Bash
      ./build/free-ran-ue gnb -c config/gnb-ho-1.yaml
      
    • gNB-ho-2:

      Bash
      ./build/free-ran-ue gnb -c config/gnb-ho-2.yaml
      

D. Start UE

  • Modify the configuration file for UE:

    The configuration YAML file template is located at free-ran-ue/config/ue-ho.yaml.

    Ensure that the information matches your web console settings, especially the authenticationSubscription section. For web console settings, please refer to: Create Subscriber via Webconsole

    Pay attention to the ueTunnelDevice field, as this will be the name of the network interface created later. The UE does not configure the target gNB: the source gNB tells the UE where the target gNB is in the handover command.

    The UE should be able to reach the target gNB's ranControlPlaneIp / ranDataPlaneIp, as it will connect to the target gNB directly after receiving the handover command.

  • Start UE:

    After configuring the YAML file,execute the binary in the build folder to start UE with the specified configuration file:

    Bash
    ./build/free-ran-ue ue -c config/ue-ho.yaml
    

E. Start Console

  • Modify the configuration file for console:

    The configuration YAML file template is located at free-ran-ue/config/console.yaml.

    The port field will be used for accessing the console page.

    Make sure the gNB's configuration YAML has the api section for console access, like:

    YAML
    api:
      ip: "10.0.1.2"
      port: 40104
    
  • Start Console

    After configuring the YAML file, execute the binary in the build folder to start console with the specified configuration file:

    Bash
    ./build/free-ran-ue console -c config/console.yaml
    
    • Sign in console:

      • username: admin
      • password: free-ran-ue

      free-ran-ue-console-login

    • Add gNB:

      Enter the gNB page:

      free-ran-ue-gNB

      Click the Add gNB button and enter the API IP and port of both gNBs based on the configuration file:

      free-ran-ue-gNB-add

F. ICMP Test

After UE has started, a network interface will be available. Use ifconfig to check it:

Bash
ifconfig

Expected output included:

Bash
ueTun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.60.0.1  netmask 255.255.255.255  destination 10.60.0.1
        inet6 fe80::b1e9:2933:3c64:b981  prefixlen 64  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 144 (144.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • Before handover:

    ICMP test with ueTun0 via gNB-ho-1:

    Bash
    ping -I ueTun0 1.1.1.1 -c 5
    

    Expected successful output:

    Bash
    PING 1.1.1.1 (1.1.1.1) from 10.60.0.2 ueTun0: 56(84) bytes of data.
    64 bytes from 1.1.1.1: icmp_seq=1 ttl=49 time=4.51 ms
    64 bytes from 1.1.1.1: icmp_seq=2 ttl=49 time=4.46 ms
    64 bytes from 1.1.1.1: icmp_seq=3 ttl=49 time=4.27 ms
    64 bytes from 1.1.1.1: icmp_seq=4 ttl=49 time=3.97 ms
    64 bytes from 1.1.1.1: icmp_seq=5 ttl=49 time=4.64 ms
    
    --- 1.1.1.1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4007ms
    rtt min/avg/max/mdev = 3.972/4.371/4.644/0.232 ms
    
  • Use console to hand over the UE from gNB-ho-1 to gNB-ho-2:

    1. Enter gNB-ho-1's information page (click Open on its card in the gNB page), the UE is listed in the RAN UEs list:

      free-ran-ue-gNB-ho-list

    2. Click the Handover button of the UE, select gNB-ho-2 as the target gNB and click Handover:

      free-ran-ue-gNB-ho

  • After handover:

    ICMP test with ueTun0 via gNB-ho-2:

    Bash
    ping -I ueTun0 1.1.1.1 -c 5
    

    Expected successful output:

    Bash
    PING 1.1.1.1 (1.1.1.1) from 10.60.0.2 ueTun0: 56(84) bytes of data.
    64 bytes from 1.1.1.1: icmp_seq=1 ttl=49 time=4.51 ms
    64 bytes from 1.1.1.1: icmp_seq=2 ttl=49 time=4.46 ms
    64 bytes from 1.1.1.1: icmp_seq=3 ttl=49 time=4.27 ms
    64 bytes from 1.1.1.1: icmp_seq=4 ttl=49 time=3.97 ms
    64 bytes from 1.1.1.1: icmp_seq=5 ttl=49 time=4.64 ms
    
    --- 1.1.1.1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4007ms
    rtt min/avg/max/mdev = 3.972/4.371/4.644/0.232 ms
    
  • Use console to hand over the UE back from gNB-ho-2 to gNB-ho-1:

    1. Enter gNB-ho-2's information page, the UE is listed in the RAN UEs list.
    2. Click the Handover button of the UE, select gNB-ho-1 as the target gNB and click Handover.
  • After handover back:

    ICMP test with ueTun0 via gNB-ho-1:

    Bash
    ping -I ueTun0 1.1.1.1 -c 5
    

    Expected successful output:

    Bash
    PING 1.1.1.1 (1.1.1.1) from 10.60.0.2 ueTun0: 56(84) bytes of data.
    64 bytes from 1.1.1.1: icmp_seq=1 ttl=49 time=4.51 ms
    64 bytes from 1.1.1.1: icmp_seq=2 ttl=49 time=4.46 ms
    64 bytes from 1.1.1.1: icmp_seq=3 ttl=49 time=4.27 ms
    64 bytes from 1.1.1.1: icmp_seq=4 ttl=49 time=3.97 ms
    64 bytes from 1.1.1.1: icmp_seq=5 ttl=49 time=4.64 ms
    
    --- 1.1.1.1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4007ms
    rtt min/avg/max/mdev = 3.972/4.371/4.644/0.232 ms