[Free5GC] environment installation and construction

1. Steps to install Ubuntu virtual machine 1.1. Download the latest Ubuntu Server LTS image file Search "ubuntu ser...
1. Steps to install Ubuntu virtual machine
2. Establish Free5GC VM and set up network
3. Install and test Free5GC core network
4. Install UE/RAN simulator
5. free5gGC small test

1. Steps to install Ubuntu virtual machine

1.1. Download the latest Ubuntu Server LTS image file

Search "ubuntu server download" to Ubuntu Official website Download the latest. iso image file of Ubuntu Server LTS. (for example, in this article, write the current Download page , select option 2 (manual server installation).

Ubuntu Server LTS download page

The downloaded. ISO name is similar to ubuntu-20.04.3-live-server-amd64.iso (in the download directory of the browser)

Download the Ubuntu server. ISO file

1.2. Create an Ubuntu Server VM

Run VMware and use the downloaded Ubuntu Server. ISO to build an Ubuntu VM. The reason for using Ubuntu Server instead of Ubuntu Desktop is that we only need basic Server functions. The Server version will not install many unnecessary functions. The space requirement is small and the boot speed is fast.

There are several considerations when establishing a new VM:

  • Change the VM name to Ubuntu, Ubuntu server, or ubuntu-20.04
  • One or two CPU s are optional, and the memory is set to 2048 M, which can be reset before power on.
  • In addition to the preset NAT network card, the network configurator adds a host only network card only for the host

VM basic settings

Start installing Ubuntu

  • User name and password are recommended to be short and easy to type (they will be used frequently later)
  • It is recommended not to use LVM mode when formatting the hard disk (it will be a little easier to expand the hard disk space in the future)
  • Choose to install SSH Server and let the security update download run.

The default language is English. Next:

The default IP address is not modified. Go to the next step directly:

Without modification, go to the next step:

Without modification, next step:

Cancel the disk Set up this disk as an LVM group option, and the others remain unchanged. Next:

Without modification, next step:

Select Continue. Next:

Set the login account and password. Next:

Install ssh service to facilitate remote ssh link. Next:

Choose nothing and go to the next step:

The following interface appears, which means starting the installation and waiting for the installation to complete: (a long time, about 30 ~ 40 minutes)

Waiting for security updates

After the security update is complete, restart the Ubuntu server.

Login to Ubuntu

Restart Ubuntu after installation and enter the terminal window. There will be some initial actions for the first time. Enter the account and password to log in later:

After logging in, try ifconfig command first:

ubuntu@ubuntu:~$ ifconfig Command 'ifconfig' not found, but can be installed with: sudo apt install net-tools ubuntu@ubuntu:~$

If the above results indicate that ifconfig has not been installed, issue the installation command according to its instructions and enter the password:

ubuntu@ubuntu:~$ sudo apt install net-tools

The following figure shows the installation results:

Run ifconfig again to check the system network card:

Your execution results may be different according to your settings, but note that only the IP address used by the host only network card. The above example is 192.168.135.130. Your local remote can be linked to Ubuntu through this website. (the other IP address 192.168.22.135 is a NAT network card).

Finally, try connecting to the network:

ubuntu@ubuntu:~$ ping baidu.com

1.3. Connect to Ubuntu VM Using SSH

Open xshell software locally. The advantage of Using SSH is that you can easily Copy and Paste instructions from the local side to Ubuntu, and vice versa, and you can establish multiple SSH links to operate with Ubuntu.

The following error occurred while connecting to xshell:

The server sent an unexpected packet
vim /etc/ssh/sshd_config

Add in the last line: (ssh to the server with the cmd command of win10 system, and then modify it)

KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1

Reload the file systemctl reload sshd. The problem is solved.

Repeat the previous simple instructions (ping, ifconfig) of the Ubuntu terminal to see if the results are the same. If successful, you can operate Ubuntu from the "remote" next.

ifconfig:

ping:

1.4. Update Ubuntu in SSH

Update Ubuntu to enhance system security.

sudo apt update sudo apt upgrade

Note: sudo passwd sets the root account password, and then executes the su command to switch the root user.

2. Establish Free5GC VM and set up network

Two steps are as follows:

  • Copy the existing VM and create a new free5GC VM
  • Set free5GC VM network environment

2.1. Check the existing VM

Open VMware and confirm that the existing Ubuntu VM(ubuntu) can be powered on and executed:

  • Log in with SSH and confirm that you can connect to the network after logging in
  • Make sure you have done sudo apt update and sudo apt upgrade
  • Shutdown execute sudo shutdown -P now

2.2. Establish Free5GC VM

Copy the new VM first:

  • Select an existing VM (ubuntu), right-click / manage / clone / create linked clone (need to shut down)
  • Virtual machine name free5gc
  • Select a linked clone (or a full clone)

After success

  • Start the newly established free5gc VM and log in with the same account
  • Use ping and ifconfig to determine the IP address of the link and host only network card
  • For example, the IP address may be 192.168.135.130 and the interface name may be ens33
  • Log in free5gc with SSH and confirm that you can connect

2.3. Change hostname

The copied VM hostname is still ubuntu (or the name you gave earlier). We named this computer free5gc. You can edit the / etc/hostname file with vi or nano:

sudo vim /etc/hostname # or sudo nano /etc/hostname

Change the ubuntu in the file to free5gc. If you edit with nano, you can press Ctrl-O to save the file, and then press Ctrl-X to close the file.

By the way, change the ubuntu in / etc/hosts to free5gc:

sudo vim /etc/hosts # or sudo nano /etc/hosts

The contents of the new / etc/hosts file look like this:

127.0.0.1 localhost 127.0.1.1 free5gc ...

It will take effect when you wait to reboot.

2.4. Set static IP address

The default host only network card gets the IP address from DHCP. In order to reduce the occurrence of subsequent command errors, set Ubuntu host only network card to static IP (fixed to 192.168.135.101).

$ cd /etc/netplan $ ls 00-installer-config.yaml $ cat 00-installer-config.yaml

The content of the original document is:

# This is the network config written by 'subiquity' network: ethernets: ens32: dhcp4: true ens33: dhcp4: true version: 2

Represents that the VM has two network cards. We know from the instruction ifconfig that ens33 is a host only network card. You can edit this file:

$ sudo vim 00-installer-config.yaml

New file content:

# This is the network config written by 'subiquity' network: ethernets: ens32: dhcp4: true ens33: dhcp4: no addresses: [192.168.135.101/24] version: 2

The content is correct when testing first:

$ sudo netplan try

Apply the new settings again

$ sudo netplan apply

After the execution, the IP address is changed. Re use the ` ` 192.168.135.101 address for ssh connection login, and execute ifconfig to check whether the network settings are changed:

ubuntu@free5gc:~$ ifconfig ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.22.135 netmask 255.255.255.0 broadcast 192.168.22.255 inet6 fe80::20c:29ff:fef8:bb76 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:f8:bb:76 txqueuelen 1000 (Ethernet) RX packets 198 bytes 21073 (21.0 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 96 bytes 11384 (11.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.135.101 netmask 255.255.255.0 broadcast 192.168.135.255 inet6 fe80::20c:29ff:fef8:bb80 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:f8:bb:80 txqueuelen 1000 (Ethernet) RX packets 1106 bytes 96876 (96.8 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 858 bytes 134055 (134.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 92 bytes 7116 (7.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 92 bytes 7116 (7.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Check routing table:

ubuntu@free5gc:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.22.2 0.0.0.0 UG 100 0 0 ens32 192.168.22.0 0.0.0.0 255.255.255.0 U 0 0 0 ens32 192.168.22.2 0.0.0.0 255.255.255.255 UH 100 0 0 ens32 192.168.135.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33

You can know that the host only network 192.168.135.0/24 itself is not connected to the Internet. (but we can connect to this VM locally). The connection to the Internet is made by the NAT network 192.168.22.0/24 (the gateway is 192.168.22.2)

3. Install and test Free5GC core network

Proceed as follows:

  • Install the necessary tools
  • Install free5GC
  • Test free5GC

The following installation process is a reference free5GC official website file.

If some instructions cannot be run due to the version update of free5GC in the future, please refer to the information on the official website.

3.1. Determine the system version

First use uname -r to determine the kernel version. If Ubuntu 20.04 is installed, the version should be 5.4.x.

$ uname -r 5.4.0-89-generic

Please confirm that your version is 5.0.0-23-generic or later.

3.2. Basic installation tools

3.2.1. Confirm whether the go is installed
$ go version

If there is an installed version, please delete it first (assuming that your go is installed in / usr/local/go):

$ sudo rm -rf /usr/local/go

If go is not installed on your system:

$ cd ~ # Download installation package $ wget https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz $ sudo tar -C /usr/local -xzf go1.15.7.linux-amd64.tar.gz

If the connecting to golang.org (golang. ORG) |142.251.42.241|: 443... Failed: connection rejected error occurs during wget, you need to modify the / etc/resolv.conf file

$ sudo vim /etc/resolv.conf

Change nameserver x.x.x.x to nameserver 114.114.114.114 save and exit.

After installation, paste the following command directly:

mkdir -p ~/go/ 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

To see if the installation was successful:

$ go version
3.2.2 installation of control surface dependency package
sudo apt -y update sudo apt -y install mongodb wget git sudo systemctl start mongodb
3.2.3 user side dependency package installation
sudo apt -y update sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev go get -u -v -insecure github.com/sirupsen/logrus

When you use go get -u github.com/sirupsen/logrus, you may get an error package golang.org/x/sys/unix: unrecognized import path "golang. Org / X / sys / Unix" (HTTPS fetch: get) https://golang.org/x/sys/unix?go -get=1: dial tcp 216.239.37.1:443: i/o timeout). The solution is

  • golang has established an image library on github. Download the image library on github and put it in GOPATH.
mkdir -p $GOPATH/src/golang.org/x cd $GOPATH/src/golang.org/x git clone git://github.com/golang/sync.git git clone git://github.com/golang/crypto.git git clone git://github.com/golang/sys.git
  • Or by adding an agent.
go env -w GO111MODULE=on go env -w GOPROXY=https://Goproxy.cn, cannot add proxy after direct # compilation

Then go get -u -v -insecure github.com/sirupsen/logrus.

3.3. Ubuntu host network settings

sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o ens32 -j MASQUERADE sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400 sudo systemctl stop ufw

Note: the above ens32 is the interface between the core network and the Data Network (Internet), which can be obtained by ifconfig and route. If your interface name is different, please remember to change it. In addition, note that these network settings will disappear after reboot. Remember to redo each time you reboot.

3.4. Install Free5GC core network

Install the latest version (v3.0.6)

cd ~ git clone --recursive -b v3.0.6 -j `nproc` https://github.com/free5gc/free5gc.git

If you can't download it, try the following steps:

Step 1:

cd ~ git clone --recursive -b v3.0.6 -j `nproc` git://github.com/free5gc/free5gc.git

Step 2:

cd ~/free5gc/NFs ls *

If the amf ausf n3iwf nrf nssf pcf smf udm udr file is found to be empty, then

# Delete empty folder rm -rf ~/free5gc/NFs/* # Switch to NFs directory cd ~/free5gc/NFs # Manually reset git git clone git://github.com/free5gc/amf.git/ git clone git://github.com/free5gc/ausf.git/ git clone git://github.com/free5gc/n3iwf.git/ git clone git://github.com/free5gc/nrf.git/ git clone git://github.com/free5gc/nssf.git/ git clone git://github.com/free5gc/pcf.git/ git clone git://github.com/free5gc/smf.git/ git clone git://github.com/free5gc/udm.git/ git clone git://github.com/free5gc/udr.git/ git clone git://github.com/free5gc/upf.git/ cd ~/free5gc rm -rf ~/free5gc/NFs/webconsole # The webconsole folder is also empty. As with the processing, manually git the webconsole file again git clone git://github.com/free5gc/webconsole.git

complete

Then compile free5GC:

cd ~/free5gc make

Installation gtp5g

cd ~ git clone https://github.com/free5gc/gtp5g.git cd gtp5g make sudo make install

Check gtp5g for successful installation:

lsmod | grep gtp

3.5 test free5GC

free5GC provides some test programs to test the basic functions of some 5G core network elements. Test the basic test procedure first:

cd ~/free5gc ./test.sh TestRegistration

If the word PASS appears at the end, the installation is successful! You can continue to perform the following tests one by one:

./test.sh TestRegistration ./test.sh TestGUTIRegistration ./test.sh TestServiceRequest ./test.sh TestXnHandover ./test.sh TestDeregistration ./test.sh TestPDUSessionReleaseRequest ./test.sh TestPaging ./test.sh TestN2Handover ./test.sh TestNon3GPP ./test.sh TestReSynchronisation ./test_ulcl.sh -om 3 TestRegistration

4. Install UE/RAN simulator

There are two steps:

  • Install UERANSIM
  • Simple test free5GC + UERANSIM

4.1. Establish ueramsim VM

Repeat the steps of establishing free5gc VM to generate a new VM

  • The VM is named ueransim. Remember that all network card Macs generate new ones
  • After success, confirm that you can connect to the network and log in Using SSH
  • Change the hostname to ueransim
  • Set the static IP address of the host only network card to 192.168.135.102
  • Restart and start free5gc
  • Test the connection with free5gc in ueransim ping 192.168.135.101, and test the connection with ueransim in free5gc ping 192.168.135.102

4.2 installation of uransim

Search the browser for ueransim and get the website:

Browse and read the basic information and purpose of the UERAMSIM open source project. Enter the installation page

Download UERANSIM

cd ~ git clone https://github.com/aligungr/UERANSIM cd UERANSIM git checkout v3.1.0

Update system

sudo apt update sudo apt upgrade

Installation tools

sudo apt install make sudo apt install g++ sudo apt install libsctp-dev lksctp-tools sudo apt install iproute2 sudo snap install cmake --classic

Compile UERANSIM

cd ~/UERANSIM make

4.3. Install free5GC WebConsole

free5GC provides a simple web interface WebConsole to manage UE registration data for each NF. WebConsole requires Node.js and Yan tools to compile.

First, log in to free5gc(192.168.135.101) via SSH and remove the old tools that may exist:

sudo apt remove cmdtest sudo apt remove yarn

Install Node.js and Yan

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update sudo apt-get install -y nodejs yarn

Start building WebConsole

cd ~/free5gc make webconsole

4.4. Add registration data using WebConsole

Start the WebConsole server first:

cd ~/free5gc/webconsole go run server.go

The terminal copies the website: 5000. Then open the browser locally and enter the web address http://192.168.135.101:5000

  • After opening the web page, enter the account admin and password free5gc
  • After entering, widen the browser until you see the Subscribers on the left
  • Select Subscribers and add a new data entry
  • Note: except that OP is selected for Operator Code Type, other fields retain preset data for subsequent simulators
  • After adding, press Ctrl-C on the terminal to stop the WebConsole

4.5. Set free5GC core ne parameters and UERANSIM parameters

In free5gc, we need to edit three configuration files:

  • ~/free5gc/config/amfcfg.yaml
  • ~/free5gc/config/smfcfg.yaml
  • ~/free5gc/NFs/upf/build/config/upfcfg.yaml

After SSH logs in to free5gc, change ~ / free5gc/config/amfcfg.yaml

cd ~/free5gc vim config/amfcfg.yaml

Change the IP in ngapIpList from 127.0.0.1 to 192.168.135.101, that is:

... ngapIpList: # the IP list of N2 interfaces on this AMF - 127.0.0.1

Change to

... ngapIpList: # the IP list of N2 interfaces on this AMF - 192.168.135.101 # 127.0.0.1

Then change ~ / free5gc/config/smfcfg.yaml

vim config/smfcfg.yaml

User plane_ information / up_ The IP address in nodes / UPF / interfaces / endpoints is changed from 127.0.0.8 to 192.168.135.101, i.e

... interfaces: # Interface list for this UPF - interfaceType: N3 # the type of the interface (N3 or N9) endpoints: # the IP address of this N3/N9 interface on this UPF - 127.0.0.8

Change to

... interfaces: # Interface list for this UPF - interfaceType: N3 # the type of the interface (N3 or N9) endpoints: # the IP address of this N3/N9 interface on this UPF - 192.168.135.101 # 127.0.0.8

Finally, change ~ / free5gc/NFs/upf/build/config/upfcfg.yaml to change the IP in gtpu from 127.0.0.8 to 192.168.135.101, that is:

... gtpu: - addr: 127.0.0.8

Change to

... gtpu: - addr: 192.168.135.101 # 127.0.0.8

4.6. Setting up UERANSIM

In ueransim, there are two configuration files related to free5GC:

  • ~/UERANSIM/config/free5gc-gnb.yaml
  • ~/UERANSIM/config/free5gc-ue.yaml

The second file is UE settings, and the content should be consistent with the preset registration data generated by free5gc's WebConsole without change.

First, after SSH logs in to ueransim, change ~ / UERANSIM/config/free5gc-gnb.yaml, change the IP of ngaplp and gtpip from 127.0.0.1 to 192.168.135.102, and change the address in amfconfigures to 192.168.135.101, that is

... ngapIp: 127.0.0.1 # gNB's local IP address for N2 Interface (Usually same with local IP) gtpIp: 127.0.0.1 # gNB's local IP address for N3 Interface (Usually same with local IP) # List of AMF address information amfConfigs: - address: 127.0.0.1

Change to

... ngapIp: 192.168.135.102 # 127.0.0.1 # gNB's local IP address for N2 Interface (Usually same with local IP) gtpIp: 192.168.135.102 # 127.0.0.1 # gNB's local IP address for N3 Interface (Usually same with local IP) # List of AMF address information amfConfigs: - address: 192.168.135.101 # 127.0.0.1

Then check ~ / uransim / config / free5gc-ue.yaml to see if the setting data is consistent with the data in WebConsole, for example:

# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits) supi: 'imsi-208930000000003' # Mobile Country Code value mcc: '208' # Mobile Network Code value (2 or 3 digits) mnc: '93' # Permanent subscription key key: '8baf473f2f8fd09487cccbd7097c6862' # Operator code (OP or OPC) of the UE op: '8e27b6af0e692e750f32667a3b14605d' # This value specifies the OP type and it can be either 'OP' or 'OPC' opType: 'OP' ... # Initial PDU sessions to be established sessions: - type: 'IPv4' apn: 'internet' slice: sst: 0x01 sd: 0x010203 # List of requested S-NSSAIs by this UE slices: - sst: 0x01 sd: 0x010203 ...

It is consistent with the previously added registration information.

4.7 test free5GC + UERANSIM

Log in to free5gc via SSH. If you have restarted free5gc, remember to do the following first:

sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o ens32 -j MASQUERADE sudo systemctl stop ufw

And execute the following instructions:

sudo iptables -I FORWARD 1 -j ACCEPT

After confirming that the network environment and configuration file have been changed, go to free5gc to execute. / run.sh

cd ~/free5gc ./run.sh

The free5gc core network starts.

In addition, three terminal visual windows shall be prepared to execute the uransim simulator:

In window 1, log in to ueransim and confirm that the simulator has been compiled and the configuration file has been changed. Execute NR GNB

cd ~/UERANSIM build/nr-gnb -c config/free5gc-gnb.yaml

In window 2, log in to ueransim and execute NR GNB as an administrator.

cd ~/UERANSIM sudo build/nr-ue -c config/free5gc-ue.yaml

In window 3, log in to ueransim and ping to test whether the simulator, free5GC core network and Internet are connected. First, use ifconfig to check whether the channel uesimtun0:

# ifconfig ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.22.136 netmask 255.255.255.0 broadcast 192.168.22.255 inet6 fe80::20c:29ff:fed8:883c prefixlen 64 scopeid 0x20<link> ether 00:0c:29:d8:88:3c txqueuelen 1000 (Ethernet) RX packets 161649 bytes 237293716 (237.2 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 33811 bytes 2117737 (2.1 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.135.102 netmask 255.255.255.0 broadcast 192.168.135.255 inet6 fe80::20c:29ff:fed8:8846 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:d8:88:46 txqueuelen 1000 (Ethernet) RX packets 4950 bytes 365572 (365.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5784 bytes 1009070 (1.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 1059 bytes 87750 (87.7 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1059 bytes 87750 (87.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 uesimtun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 60.60.0.1 netmask 255.255.255.255 destination 60.60.0.1 inet6 fe80::580d:6902:7845:d910 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 2 bytes 96 (96.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Then use ping:

ping -I uesimtun0 baidu.com

If there is a response, it represents the successful operation of the system and network. Congratulations~

4.8 common problems

If problems occur during the installation and execution of free5GC and UERANSIM, first remember whether the following points are implemented to complete the test:

If the free5gc VM is restarted, whether the network configuration is performed first:

sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o ens32 -j MASQUERADE sudo systemctl stop ufw sudo iptables -I FORWARD 1 -j ACCEPT

If the free5gc VM wants to execute the test. / test.sh TestXXX, check whether the configuration file is restored

~/free5gc/config/amfcfg.yaml ~/free5gc/config/smfcfg.yaml ~/free5gc/NFs/upf/build/config/upfcfg.yaml

git diff can be used to check. If there are still problems in the test, clear the MongoDB database first and try again:

$ mongo free5gc ... > db.dropDatabase() { "dropped" : "free5gc", "ok" : 1 } > exit bye

Whether the network card name and IP of the VM are correct and consistent with the relevant configuration files or commands. You can ping 192.168.135.101 and 192.168.135.102 from your host, and connect Ping to your virtual machine ifconfig and test.

If you have successfully installed and tested free5GC and UERANSIM, you can make a simple application after execution if you want to know what to do next. To understand and modify the program content of free5GC, in addition to studying 5G standard files, you can see how to set the network and program from test.sh and run.sh. Some reference documents of basic network principle are as follows:

5. free5gGC small test

In this demonstration, we will use free5GC core network and UE/RAN simulator to operate some simple network applications:

  • ping + tcpdump
  • wget
  • xxx (ssh root@xxx)

5.1,ping + tcpdump

First, start the free5gc core network and ueransim (free5gc needs one terminal and ueransim needs two terminals).

Then open the new terminal xshell and log in to ueransim:

ssh 192.168.56.102

Use ifconfig to confirm that uesimtun0 channel has been established, and use ping to try whether uesimtun0 can be connected:

$ ping baidu.com PING baidu.com (220.181.38.148) 56(84) bytes of data. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=127 time=21.5 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=127 time=21.4 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=127 time=21.7 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=127 time=22.9 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=127 time=22.7 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=127 time=22.5 ms ^C --- baidu.com ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 5018ms rtt min/avg/max/mdev = 21.361/22.102/22.875/0.603 ms
$ ping -I uesimtun0 baidu.com PING baidu.com (220.181.38.148) from 60.60.0.1 uesimtun0: 56(84) bytes of data. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=127 time=22.4 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=127 time=22.7 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=127 time=22.2 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=127 time=22.9 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=127 time=22.3 ms 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=127 time=23.3 ms ^C --- baidu.com ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 5010ms

First, use the route -n command to observe the existing routing table and display the rules for the two network interfaces ens32 and ens33:

$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.22.2 0.0.0.0 UG 100 0 0 ens32 192.168.22.0 0.0.0.0 255.255.255.0 U 0 0 0 ens32 192.168.22.2 0.0.0.0 255.255.255.255 UH 100 0 0 ens32 192.168.135.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33

The 192.168.22.0/24 network and ens32 interface are established by VMware NAT network card. Let's close this interface first:

$ sudo ifconfig ens32 down $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.135.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33

Only the host only 192.168.135.0/24 network is left. Perform ping to see:

#114.114.114.114 is the DNS commonly used by China Mobile, China Telecom and China Unicom $ ping 114.114.114.114 ping: connect: Network is unreachable

Found unable to connect, but performed:

$ ping -I uesimtun0 114.114.114.114 PING 114.114.114.114 (114.114.114.114) from 60.60.0.1 uesimtun0: 56(84) bytes of data. 64 bytes from 114.114.114.114: icmp_seq=1 ttl=127 time=28.7 ms 64 bytes from 114.114.114.114: icmp_seq=2 ttl=127 time=29.6 ms ^C --- 114.114.114.114 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 28.710/29.162/29.615/0.452 ms

There is a response because we require ping to take the free5GC core network path. To make ping 8.8.8.8 successful, we can use the uesimtun0 interface (IP 60.60.0.1) as the new default gateway:

$ sudo ip r add default dev uesimtun0 $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 uesimtun0 192.168.135.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33

In this way, all packets other than 192.168.135.0/24 will go uesimtun0. Therefore, further execution can be successful:

$ ping 114.114.114.114 PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data. 64 bytes from 114.114.114.114: icmp_seq=1 ttl=127 time=29.8 ms ^C --- 114.114.114.114 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 29.757/29.757/29.757/0.000 ms

But if you want to execute:

$ ping baidu.com ping: baidu.com: Temporary failure in name resolution

You get an unrecognizable web address. To solve this problem, we can change the configuration file / etc/resolv.conf (but remember to restore):

$ sudo vim /etc/resolv.conf

Temporarily change the nameserver IP to 114.114.114.114

nameserver 114.114.114.114

At this time, you can see the reaction:

root@ueransim:/home/ubuntu# ping baidu.com PING baidu.com (220.181.38.251) 56(84) bytes of data. 64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=127 time=22.8 ms 64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=127 time=23.8 ms 64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=3 ttl=127 time=23.4 ms ^C

To further confirm that the ping process is indeed accessed by the free5GC core network, we can open another terminal to log in to ueransim and execute the following instructions:

$ sudo tcpdump -n -i any host 60.60.0.1 or 192.168.135.101 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 byte

And ping 114.114.114.114 at the original terminal. After a few seconds, press Ctrl-C on both sides. It can be observed that the related packets are indeed sent and returned by uesimtun0.

$ sudo tcpdump -n -i any host 60.60.0.1 or 192.168.135.101 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes 01:47:59.034673 IP 60.60.0.1 > 114.114.114.114: ICMP echo request, id 10, seq 1, length 64 01:47:59.035680 IP 192.168.135.102.2152 > 192.168.135.101.2152: UDP, length 100 01:47:59.063457 IP 192.168.135.101.2152 > 192.168.135.102.2152: UDP, length 100 01:47:59.064005 IP 114.114.114.114 > 60.60.0.1: ICMP echo reply, id 10, seq 1, length 64 01:48:00.038335 IP 60.60.0.1 > 114.114.114.114: ICMP echo request, id 10, seq 2, length 64 01:48:00.038900 IP 192.168.135.102.2152 > 192.168.135.101.2152: UDP, length 100 01:48:00.066075 IP 192.168.135.101.2152 > 192.168.135.102.2152: UDP, length 100

5.2,wget

Download from any website on the network. For example:

$ wget baidu.com --2021-11-06 01:39:54-- http://baidu.com/ Resolving baidu.com (baidu.com)... 220.181.38.251, 220.181.38.148 Connecting to baidu.com (baidu.com)|220.181.38.251|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 81 [text/html] Saving to: 'index.html' index.html 100%[================================================================>] 81 --.-KB/s in 0s 2021-11-06 01:39:54 (6.77 MB/s) - 'index.html' saved [81/81]

Can download Baidu page home page.

5.3,ssh

Try whether you can connect to the Internet server:

ssh [email protected]

Reference website:

https://github.com/free5gc/free5gc

https://blog.csdn.net/weixin_41973619/article/details/109121184

https://www.free5gc.org/installations/stage-3/

10 November 2021, 16:05 | Views: 2678

Add new comment

For adding a comment, please log in
or create account

0 comments