ODL(OpenDayLight) 是常见、开源的 SDN 控制器,本文介绍如何在 Linux/CentOS 安装 OpenDayLight。
环境
安装依赖包:
yum install java-11-openjdk maven -y
配置 Java 环境变量到 /etc/profile:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.10.0.9-1.el7_9.x86_64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
安装完成后验证:
$ java -version
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9-LTS, mixed mode, sharing)
安装
# 下载
wget https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/opendaylight/0.13.3/opendaylight-0.13.3.tar.gz
# 解压
tar -zxvf opendaylight-0.13.3.tar.gz
cd opendaylight-0.13.3
# 启动
./bin/start
# 检查状态
./bin/status
# 登入,密码为 karaf
./bin/client -u karaf
以上操作也可以使用如下命令登入:
./bin/karaf
Apache Karaf starting up. Press Enter to open the shell now...
100% [========================================================================]
Karaf started in 0s. Bundle stats: 12 active, 12 total
    ________                       ________                .__  .__       .__     __
    \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_
     /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\
    /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |
    \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|
            \/|__|        \/     \/        \/     \/\/            /_____/      \/
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.
opendaylight-user@root>
安装插件
opendaylight-user@root>feature:list -i
opendaylight-user@root>feature:install odl-restconf
opendaylight-user@root>feature:install odl-netvirt-openstack
安装 odl-netvirt-openstack 后:
- controller 默认监听在 6633
- manager 默认监听在 6640
ss -lpn |grep java
tcp    LISTEN     0      50     [::]:44444              [::]:*                   users:(("java",pid=13345,fd=118))
tcp    LISTEN     0      50     [::]:35996              [::]:*                   users:(("java",pid=13345,fd=26))
tcp    LISTEN     0      128    [::]:6653               [::]:*                   users:(("java",pid=13345,fd=673))
tcp    LISTEN     0      50     [::]:8101               [::]:*                   users:(("java",pid=13345,fd=126))
tcp    LISTEN     0      50     [::]:46087              [::]:*                   users:(("java",pid=13418,fd=14))
tcp    LISTEN     0      128    [::]:6633               [::]:*                   users:(("java",pid=13345,fd=698))
tcp    LISTEN     0      50     [::]:1099               [::]:*                   users:(("java",pid=13345,fd=117))
tcp    LISTEN     0      1        [::ffff:127.0.0.1]:36715              [::]:*                   users:(("java",pid=13345,fd=50))
tcp    LISTEN     0      100    [::]:6640               [::]:*                   users:(("java",pid=13345,fd=344))
tcp    LISTEN     0      50       [::ffff:127.0.0.1]:6644               [::]:*                   users:(("java",pid=13345,fd=383))
tcp    LISTEN     0      50     [::]:8181               [::]:*                   users:(("java",pid=13345,fd=407))
tcp    LISTEN     0      128      [::ffff:127.0.0.1]:2550               [::]:*                   users:(("java",pid=13345,fd=69))
tcp    LISTEN     0      128    [::]:8185               [::]:*                   users:(("java",pid=13345,fd=661))
管理 OpenvSwtich 配置参考
- 安装 Web UI插件,仅在0.3.x-Lithium版本支持
opendaylight-user@root>feature:install odl-mdsal-apidocs
opendaylight-user@root>feature:install odl-l2switch-switch-ui
opendaylight-user@root>feature:install odl-mdsal-apidocs
opendaylight-user@root>feature:install odl-dluxapps-applications
扩展
ODL在也可以作为 neutron ML2 plugin 的 mechanism driver 和 OpenStack 集成,接管 neutron 对 OVS 进行控制。