使用 netopeer2 搭建 NETCONF server

丁叮盯町
4 min readJun 17, 2022

--

安裝過程

在 Ubuntu Linux 安裝必要的 dependancies。

sudo apt-get install libtool python-argparse libtool-bin python-sphinx libffi-devlibxml2-dev libxslt1-dev libcurl4-openssl-dev xsltproc python-setuptoo ls cmake zlib1g-dev libssl-dev python-libxml2 libaugeas-dev openssh-se rver libreadline-dev

下載並安裝 pyang tool:

git clone https://github.com/mbj4668/pyang.git 
cd pyang
python setup.py install

如果 lxml 安裝失敗,試著手動安裝:

pip install lxml

下載 libssh 源碼包並解壓縮 (https://git.libssh.org/projects/libssh.git) 我下載的是 libssh-0.9.6 版本。

cd libssh-0.9.6 
mkdir build
cd build
cmake ..
make
sudo make install

安裝完成 libpcre 後,下載 libyang,編譯後安裝。

sudo apt install libpcre2-16-0
sudo apt-get install -y libpcre2-dev
git clone https://github.com/CESNET/libyang.git
cd libyang; mkdir build; cd build
cmake ..
make
sudo make install

下載 libnetconf2,編譯後安裝。

git clone https://github.com/CESNET/libnetconf2.git 
cd libnetconf2
mkdir build; cd build
cmake ..
make
sudo make install

下載 sysrepo,編譯後安裝。

git clone https://github.com/sysrepo/sysrepo.git 
cd sysrepo
mkdir build; cd build
cmake ..
make
sudo make install

下載 netopeer2,編譯後安裝。

git clone https://github.com/CESNET/netopeer2.git 
cd netopeer2
mkdir build; cd build
cmake ..
make
sudo make install

如果出現 “error while loading shared libraries: libsysrepo.so.6” 的錯誤,先確認 libsysrepo.so.6 是否已安裝在 /usr/local/lib。然後更新一下 ld.so.conf :

sudo sh -c "echo '/usr/local/lib' >> /etc/ld.so.conf" 
sudo ldconfig

重新 make install,netopeer2 即可安裝成功。

驗證 NETCONF server

從 Terminal 開啟 netopeer2 server:

sudo netopeer2-server -d -v 2

新開 Terminal,從 client 端連上本機 server,結果如下:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

丁叮盯町
丁叮盯町

Written by 丁叮盯町

0 Followers

單純的程序猿,想寫些什麼記錄生活、記錄所學

No responses yet