如何开展实验
先看完前一篇的《历史遗留错误解决》 , 再看本篇, 不然你会感到举步维艰...
实验开始前的准备工作
Note
每次远程登录进一个服务器,都要对它做这些操作 🌶️
启动 mongodb:
Bash sudo systemctl start mongod
sudo systemctl enable mongod
创建虚拟接口 ogstun
:
Bash sudo ip tuntap add name ogstun mode tun
sudo ip addr add 10 .45.0.1/16 dev ogstun
sudo ip addr add 2001 :db8:cafe::1/48 dev ogstun
sudo ip link set ogstun up
网络设置:
启用转发并添加 NAT 规则
Bash sudo sysctl -w net.ipv4.ip_forward= 1
sudo sysctl -w net.ipv6.conf.all.forwarding= 1
sudo iptables -t nat -A POSTROUTING -s 10 .45.0.0/16 ! -o ogstun -j MASQUERADE
sudo ip6tables -t nat -A POSTROUTING -s 2001 :db8:cafe::/48 ! -o ogstun -j MASQUERADE
正确配置防火墙
清理数据库:
Bash mongosh
> use open5gs
switched to db open5gs
> db.subscribers.find() ### Check the test subscriber
> db.subscribers.drop() ### Remove all subscriber
> db.subscribers.find() ### Check that all subscribers are empty
清理进程:
Bash 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 ps -ef | grep open5gs
sudo pkill -9 open5gs-mmed
sudo pkill -9 open5gs-sgwcd
sudo pkill -9 open5gs-smfd
sudo pkill -9 open5gs-amfd
sudo pkill -9 open5gs-sgwud
sudo pkill -9 open5gs-upfd
sudo pkill -9 open5gs-hssd
sudo pkill -9 open5gs-pcrfd
sudo pkill -9 open5gs-nrfd
sudo pkill -9 open5gs-scpd
sudo pkill -9 open5gs-seppd
sudo pkill -9 open5gs-ausfd
sudo pkill -9 open5gs-udmd
sudo pkill -9 open5gs-pcfd
sudo pkill -9 open5gs-nssfd
sudo pkill -9 open5gs-bsfd
sudo pkill -9 open5gs-udrd
ps?
ps -ef
:
-e
: 显示所有进程 (不仅是当前用户的)
-f
: 以全格式显示进程信息,包括进程ID、父进程ID、CPU使用率、内存使用率
ps -a
:
-a
: 显示所有与当前终端会话相关的进程 (仅当前用户)
实验预热: 测试基础模块
测试: 构建成功否
Bash cd build
./tests/registration/registration ## 5G Core Only
./tests/attach/attach ## EPC Only
meson test -v
必须要全部通过才可以,不能有任何一个部件出现闪失
Standard Output
测试: 安装成功否
这一步基本上都没啥问题
测试: 各模块正常工作否
Bash 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 cd ..
./install/bin/open5gs-nrfd
./install/bin/open5gs-scpd
./install/bin/open5gs-seppd -c ./install/etc/open5gs/sepp1.yaml
./install/bin/open5gs-amfd
./install/bin/open5gs-smfd
./install/bin/open5gs-upfd
./install/bin/open5gs-ausfd
./install/bin/open5gs-udmd
./install/bin/open5gs-pcfd
./install/bin/open5gs-nssfd
./install/bin/open5gs-bsfd
./install/bin/open5gs-udrd
./install/bin/open5gs-mmed
./install/bin/open5gs-sgwcd
./install/bin/open5gs-sgwud
./install/bin/open5gs-hssd
./install/bin/open5gs-pcrfd
必须要全部通过才可以, 每一个指令运行后都会一直执行,需要 ctrl+c
退出
这里给出每一个实例通过的logging msg, 便于读者判断该组件是否正常工作 👀
Standard Logging Msg for Each Module
Bash 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 $ ./install/bin/open5gs-nrfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:15.476: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nrf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:15.476: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nrf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:15.478: [ sbi] INFO: nghttp2_server() [ http://127.0.0.10] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:15.478: [ app] INFO: NRF initialize...done ( ../src/nrf/app.c:31)
$ ./install/bin/open5gs-scpd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:17.105: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/scp.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:17.105: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/scp.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:17.107: [ sbi] INFO: nghttp2_server() [ http://127.0.0.200] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:17.107: [ app] INFO: SCP initialize...done ( ../src/scp/app.c:31)
$ ./install/bin/open5gs-seppd -c ./install/etc/open5gs/sepp1.yaml
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:23.191: [ app] INFO: Configuration: './install/etc/open5gs/sepp1.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:23.191: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp1.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:23.193: [ sbi] INFO: nghttp2_server() [ http://127.0.1.250] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:23.197: [ sbi] INFO: nghttp2_server( n32f) [ https://127.0.1.252] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:23.198: [ sbi] INFO: nghttp2_server( sepp) [ https://127.0.1.251] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:23.199: [ app] INFO: SEPP initialize...done ( ../src/sepp/app.c:31)
$ ./install/bin/open5gs-amfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:26.041: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/amf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:26.041: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/amf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:26.045: [ metrics] INFO: metrics_server() [ http://127.0.0.5] :9090 ( ../lib/metrics/prometheus/context.c:299)
10 /02 10 :09:26.045: [ sbi] INFO: NF Service [ namf-comm] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:26.045: [ sbi] INFO: nghttp2_server() [ http://127.0.0.5] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:26.045: [ amf] INFO: ngap_server() [ 127 .0.0.5] :38412 ( ../src/amf/ngap-sctp.c:61)
10 /02 10 :09:26.046: [ sctp] INFO: AMF initialize...done ( ../src/amf/app.c:33)
$ ./install/bin/open5gs-smfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:27.887: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/smf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:27.887: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/smf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:27.947: [ metrics] INFO: metrics_server() [ http://127.0.0.4] :9090 ( ../lib/metrics/prometheus/context.c:299)
10 /02 10 :09:27.990: [ gtp] INFO: gtp_server() [ 127 .0.0.4] :2123 ( ../lib/gtp/path.c:30)
10 /02 10 :09:27.990: [ gtp] INFO: gtp_server() [ 127 .0.0.4] :2152 ( ../lib/gtp/path.c:30)
10 /02 10 :09:27.990: [ pfcp] INFO: pfcp_server() [ 127 .0.0.4] :8805 ( ../lib/pfcp/path.c:30)
10 /02 10 :09:27.990: [ pfcp] INFO: ogs_pfcp_connect() [ 127 .0.0.7] :8805 ( ../lib/pfcp/path.c:61)
10 /02 10 :09:27.990: [ sbi] INFO: NF Service [ nsmf-pdusession] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:27.990: [ sbi] INFO: nghttp2_server() [ http://127.0.0.4] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:27.990: [ app] INFO: SMF initialize...done ( ../src/smf/app.c:31)
$ ./install/bin/open5gs-upfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:34.259: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:34.259: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/upf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:34.340: [ metrics] INFO: metrics_server() [ http://127.0.0.7] :9090 ( ../lib/metrics/prometheus/context.c:299)
10 /02 10 :09:34.340: [ pfcp] INFO: pfcp_server() [ 127 .0.0.7] :8805 ( ../lib/pfcp/path.c:30)
10 /02 10 :09:34.341: [ gtp] INFO: gtp_server() [ 127 .0.0.7] :2152 ( ../lib/gtp/path.c:30)
10 /02 10 :09:34.343: [ app] INFO: UPF initialize...done ( ../src/upf/app.c:31)
$ ./install/bin/open5gs-ausfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:35.832: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/ausf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:35.832: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/ausf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:35.834: [ sbi] INFO: NF Service [ nausf-auth] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:35.834: [ sbi] INFO: nghttp2_server() [ http://127.0.0.11] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:35.835: [ app] INFO: AUSF initialize...done ( ../src/ausf/app.c:31)
$ ./install/bin/open5gs-udmd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:40.766: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:40.766: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udm.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:40.768: [ sbi] INFO: NF Service [ nudm-ueau] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:40.768: [ sbi] INFO: NF Service [ nudm-uecm] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:40.768: [ sbi] INFO: NF Service [ nudm-sdm] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:40.768: [ sbi] INFO: nghttp2_server() [ http://127.0.0.12] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:40.769: [ app] INFO: UDM initialize...done ( ../src/udm/app.c:31)
$ ./install/bin/open5gs-pcfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:43.335: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:43.335: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:43.337: [ metrics] INFO: metrics_server() [ http://127.0.0.13] :9090 ( ../lib/metrics/prometheus/context.c:299)
10 /02 10 :09:43.340: [ dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' ( ../lib/dbi/ogs-mongoc.c:130)
10 /02 10 :09:43.340: [ sbi] INFO: NF Service [ npcf-am-policy-control] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:43.340: [ sbi] INFO: NF Service [ npcf-smpolicycontrol] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:43.340: [ sbi] INFO: NF Service [ npcf-policyauthorization] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:43.340: [ sbi] INFO: nghttp2_server() [ http://127.0.0.13] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:43.340: [ app] INFO: PCF initialize...done ( ../src/pcf/app.c:31)
$ ./install/bin/open5gs-nssfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:44.960: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nssf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:44.960: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nssf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:44.962: [ sbi] INFO: NF Service [ nnssf-nsselection] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:44.962: [ sbi] INFO: nghttp2_server() [ http://127.0.0.14] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:44.962: [ app] INFO: NSSF initialize...done ( ../src/nssf/app.c:31)
$ ./install/bin/open5gs-bsfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:47.413: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/bsf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:47.413: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/bsf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:47.415: [ sbi] INFO: NF Service [ nbsf-management] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:47.415: [ sbi] INFO: nghttp2_server() [ http://127.0.0.15] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:47.415: [ app] INFO: BSF initialize...done ( ../src/bsf/app.c:31)
$ ./install/bin/open5gs-udrd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:49.159: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:49.159: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udr.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:49.162: [ dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' ( ../lib/dbi/ogs-mongoc.c:130)
10 /02 10 :09:49.162: [ sbi] INFO: NF Service [ nudr-dr] ( ../lib/sbi/context.c:1744)
10 /02 10 :09:49.162: [ sbi] INFO: nghttp2_server() [ http://127.0.0.20] :7777 ( ../lib/sbi/nghttp2-server.c:414)
10 /02 10 :09:49.162: [ app] INFO: UDR initialize...done ( ../src/udr/app.c:31)
$ ./install/bin/open5gs-mmed
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:54.793: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:54.793: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/mme.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:54.796: [ metrics] INFO: metrics_server() [ http://127.0.0.2] :9090 ( ../lib/metrics/prometheus/context.c:299)
10 /02 10 :09:54.844: [ gtp] INFO: gtp_server() [ 127 .0.0.2] :2123 ( ../lib/gtp/path.c:30)
10 /02 10 :09:54.844: [ gtp] INFO: gtp_connect() [ 127 .0.0.3] :2123 ( ../lib/gtp/path.c:60)
10 /02 10 :09:54.844: [ mme] INFO: s1ap_server() [ 127 .0.0.2] :36412 ( ../src/mme/s1ap-sctp.c:62)
10 /02 10 :09:54.844: [ sctp] INFO: MME initialize...done ( ../src/mme/app-init.c:33)
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :09:57.549: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :09:57.549: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwc.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :09:57.607: [ gtp] INFO: gtp_server() [ 127 .0.0.3] :2123 ( ../lib/gtp/path.c:30)
10 /02 10 :09:57.607: [ pfcp] INFO: pfcp_server() [ 127 .0.0.3] :8805 ( ../lib/pfcp/path.c:30)
10 /02 10 :09:57.607: [ pfcp] INFO: ogs_pfcp_connect() [ 127 .0.0.6] :8805 ( ../lib/pfcp/path.c:61)
10 /02 10 :09:57.607: [ app] INFO: SGW-C initialize...done ( ../src/sgwc/app.c:31)
$ ./install/bin/open5gs-sgwud
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :10:01.720: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :10:01.720: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwu.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :10:01.775: [ pfcp] INFO: pfcp_server() [ 127 .0.0.6] :8805 ( ../lib/pfcp/path.c:30)
10 /02 10 :10:01.775: [ gtp] INFO: gtp_server() [ 127 .0.0.6] :2152 ( ../lib/gtp/path.c:30)
10 /02 10 :10:01.776: [ app] INFO: SGW-U initialize...done ( ../src/sgwu/app.c:31)
$ ./install/bin/open5gs-hssd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :10:05.765: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/hss.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :10:05.765: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/hss.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :10:05.766: [ dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' ( ../lib/dbi/ogs-mongoc.c:130)
10 /02 10 :10:05.853: [ app] INFO: HSS initialize...done ( ../src/hss/app-init.c:31)
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v2.6.4-59-g204ad57+
10 /02 10 :10:07.843: [ app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' ( ../lib/app/ogs-init.c:129)
10 /02 10 :10:07.843: [ app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcrf.log' ( ../lib/app/ogs-init.c:132)
10 /02 10 :10:07.844: [ dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' ( ../lib/dbi/ogs-mongoc.c:130)
10 /02 10 :10:07.879: [ app] INFO: PCRF initialize...done ( ../src/pcrf/app-init.c:31)
⚠️ 一定要看到每个module出现这种“初始化成功”的显示信息 ⚠️
Bash Time Stamp: [ app] INFO: MODULE_NAME initialize...done ( ../src/sepp/app.c:31)
Testing All in One
这条指令相当于一键测试(按顺序)了上述所有指令
但是不推荐用,因为单元测试更有利于看出到底是谁出了问题
实验1: 5G Roaming