---
title: 'N3IWF and N3IWUE Installation'
disqus: hackmd
---
Installation N3IWF and N3IWUE
===
[TOC]
## Installing N3IWF
If you are a total beginner to this, start here!
Visit free5gc.org
Install https://free5gc.org/guide/3-install-free5gc/
Follow https://free5gc.org/guide/n3iwue-installation/
Mesurement environment by Iperf https://lindevs.com/install-iperf-on-ubuntu
Mesurement environment by Wireshark
## Installing Step
First step we will need 2 VM for run this scenario, there are:
VM for free5gc and N3IWF (e.g: Static IP 192.168.1.130)
VM for N3IWUE (e.g: Static IP 192.168.1.131)
## Installing free5gc and N3IWF (non3GPP Access)
Install free5gc and N3IWF in VM 1 do NOT to be config for AMF, SMF and UPF. If you ever install it before you need to change it to the defult configuration.We just use the defult configuration, here the configuration:
## AMF
```
cd ~free5gc
sudo nano ~/free5gc/config/amfcfg.yaml
```
Scroll and take a look for the amf configuration, and make sure for this configuration, don't change anythings:

## SMF
```
sudo nano ~/free5gc/config/smfcfg.yaml
```
Scroll and take a look for the smf configuration, and make sure for this configuration, don't change anythings:

## UPF
```
sudo nano ~/free5gc/config/upfcfg.yaml
```

## N3IWF
```
~/free5gc/config/n3iwfcfg.yaml
```
Replace IKEBindAddress from 172.16.2.100 to 192.168.1.130, namely from:

into

## Installing N3IWUE (non3GPP Access)
Install N3IWUE in VM 2, here the step:
Download N3IWUE
```
cd ~
git clone https://github.com/free5gc/n3iwue.git
cd n3iwue
```
update and upgrade the VM of N3IWUE
```
sudo apt update
sudo apt upgrade
```


install required tool (make, libsctp-dev, lksctp-tools, iproute2)
```
sudo apt install make
sudo apt install libsctp-dev lksctp-tools
sudo apt install iproute2
```

Install Golang (use 1.21.6 version in this demonstrate):
```
wget https://dl.google.com/go/go1.21.6.linux-amd64.tar.gz
sudo tar -C /usr/local -zxvf go1.21.6.linux-amd64.tar.gz
mkdir -p ~/go/{bin,pkg,src}
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 your go installation
go version
```

Build N3IWUE
```
cd ~/n3iwue
make
```

To let N3IWUE knows where is the N3IWF is, we need to edit the UE config file bysudo nano ~/n3iwue/config/n3ue.yaml in N3IWUE VM
Replace these parameters:

into

Open your web browser from your host machine, and enter the URL http://192.168.1.130:5000
1. On the login page, enter username admin and password free5gc.
2. Once logged in, widen the page until you see “Subscribers” on the left-hand side column.
3. Click on the Subscribers tab and then on the New Subscriber button
4. Scroll down to Operator Code Type and change it from "OPc" to "OP".
5. Make sure the following config between n3iwue/config/n3ue.yaml and Subscriber you create are the same:
* IMSI ex: MCC+MNC+MSIN (ex. 208930000001234)
* K
* SQN
* OP value (choose OP instead of OPC)
6. Scroll all the way down and click on Submit.

## Testing N3IWUE with free5GC
SSH into free5gc. If you have rebooted free5gc, remember to run:
```
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o <dn_interface> -j MASQUERADE
# e.g. sudo iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
sudo systemctl stop ufw
sudo systemctl disable ufw
```
Tips : Set net.ipv4.ip_forward=1 in /etc/sysctl.conf to enable packet forwarding permanently
In free5gc VM:
```
cd ~/free5gc
./run.sh -n3iwf
```


The information about the fatal error, indicated by red, suggests that the error occurred due to entering the wrong IP address.
And after the change the IP in ~/free5gc/config/n3iwfcfg.yaml
Into

And This the Final Running



In N3IWUE VM:
```
cd ~/n3iwue
./run.sh
```



😊 Thank you 😊