ns3 설치
1. Ubuntu 설치
2. ns-3 다운로드
* 최신 버전은 ns-3 공식 문서를 참고하여 다운로드 받길 바란다.
ns-3.33 버전 문서[1]를 바탕으로 진행.
필수구성요소
| Prerequisite | Package/version | Code | Current version
| :---: | :---: | :---: |
| C++ 컴파일러 | clang++ 또는 g++(4.9 버전 이상) | sudo apt install g++ | 11.3.0 |
| Python | python3 버전 >= 3.5 | sudo apt install python3 | 3.10.6 |
| Git | 최신 버전 (GitLab.com에서 ns-3에 엑세스) | sudo apt install git | 2.34.1 |
| tar | 최신 버전 (ns-3 릴리스 unpack) | sudo apt install tar | 1.34 |
| bunzip2 | 최신 버전 (ns-3 릴리스 uncompress) | sudo apt install bzip2 | 1.0.8 |
아마 git 빼고 모두 ubuntu에 이미 설치되어있음.
경로는 root@root:~#에서 진행
$ cd
$ mkdir workspace
$ cd workspace
$ git clone https://gitlab.com/nsnam/ns-3-allinone.git
$ cd ns-3-allinone
$ ls
build.py constants.py dist.py download.py README.md util.py
$ python3 download.py -n ns-3.33
다운로드가 완료되면, ns-3.33 폴더 안을 확인할 수 있다.
$:~/workspace/ns-3-allinone/ns-3.33# ls
AUTHORS CONTRIBUTING.md Makefile src utils.py waf-tools
bindings doc README.md test.py VERSION wscript
CHANGES.html examples RELEASE_NOTES testpy.supp waf wutils.py
contrib LICENSE scratch utils waf.bat
3. 빌드
$ ./waf configure --enable-examples --enable-tests
$ ./waf build
를 실행한다. 상황에 맞게 enable 할 모드를 정하면 된다.
빌드 시 몇몇 오류가 발생할 수 있다.
나의 경우에 다음의 오류가 발생했다.
-
task in ‘ns3-core’ failed with exit status 1: (csv-reader.cc 파일 오류)
오류 해결 error: ‘numeric_limits’ is not a member of ‘std’ csv-reader.h 파일에 #include <stddef.h>#include <limits>
를 포함시킨다[2].
$ nano ./src/core/helper/csv-reader.herror: expected primary-expression before ‘>’ token ” error: ‘::min’ has not been declared; did you mean ‘std::min’?
error: ‘::max’ has not been declared; did you mean ‘std::max’?”
파일 수정이 완료되면
$ ./waf build
다시 빌드를 시도한다. 첫 빌드에는 시간이 꽤 걸린다. PC마다 다를 수 있지만 나의 경우에는 대략 5분 정도 소요되었다.
![[Fig. 1] Build 완료.](/blog/ns3-install/1.png)
기본 예제 연습은 ns3 예제를 참고바란다.
* ns-3 최신 버전에서는 waf가 ns3로 변경되었다.
Reference
- ns-3.33 Documentation
- ‘numeric_limits’ is not a member of ‘std’, stackoverflow.