恒美微站
首页
关于我们
建站服务
主题模板
案例展示
资讯中心
联系我们
ISPSrv之SDN
首页
资讯中心
/
ISPSrv之SDN
ISPSrv之SDN
发布时间:2026/8/30 7:26:11
SDN题目详细在 IspSrv 上导入 OpenDayLight 软件包启动 OpenDayLight 的 karaf 程序并安装如下组件feature:install odl-restconffeature:install odl-l2switch-switch-uifeature:install odl-mdsal-apidocsfeature:install odl-dluxapps-applications使用 Mininet 和 OpenVswitch 构建拓扑连接 ODL 的 6653 端口如下 拓扑结构在浏览器上可以访问 ODL 管理页面查看网元拓扑结构通过 OVS 给 S2 下发流表使得 H2 与 H1、H3 无法互通H1 启动 HTTP-Server 功能WEB 端口为 8080H3 作为 HTTP-Client 获取 H1 的 html 网页配置文件。系统环境主机ip地址作用说明ISPSrv81.6.63.100/24SDN服务器做题步骤 上传软件包rootispsrv:~# apt -y install lrzszrootispsrv:~# rzrz waiting to receive. zmodem trlC ȡ 正在传输 distribution-karaf-0.6.0-Carbon.zip...100%425034KB10898KB/ 00:00:390正在传输 mininet_2.2.2-4_amd64.deb...100%121KB121KB/ 00:00:010 安装jdk、openvswitch和解压opendaylightrootispsrv:~# apt-get -y install openjdk-8-jdk openvswitch-switchrootispsrv:~# unzip distribution-karaf-0.6.0-Carbon.zip 启动 OpenDayLight 的 karaf 程序:rootispsrv:~# ./distribution-karaf-0.6.0-Carbon/bin/karaf 安装组件feature:install odl-restconffeature:install odl-l2switch-switch-uifeature:install odl-mdsal-apidocsfeature:install odl-dluxapps-applicationsopendaylight-userrootfeature:install odl-restconf opendaylight-userrootfeature:install odl-l2switch-switch-ui opendaylight-userrootfeature:install odl-mdsal-apidocs opendaylight-userrootfeature:install odl-dluxapps-applications 安装Mininetrootispsrv:~# dpkg -i mininet_2.2.2-4_amd64.debrootispsrv:~# apt-get --fix-broken install -y //修复依赖包之间的关系rootispsrv:~# dpkg -i mininet_2.2.2-4_amd64.deb 创建拓扑rootIspSrv:~# mn --controllerremote,ip81.6.63.100,port6653 --topolinear,3,1 --switchovs,protocolsOpenFlow10mininetpingall *** Ping: testingpingreachability h1 -h2 h3 h2 -h1 h3 h3 -h1 h2 *** Results:0% dropped(6/6 received)mininetmn调用 Mininet 的可执行程序。--controllerremote,ip81.6.63.100,port6653指定控制器的类型为远程控制器并设置其 IP 地址为81.6.63.100端口号为6653。这意味着 Mininet 启动后交换机会主动连接到此 IP 和端口上的 OpenFlow 控制器例如 Floodlight、OpenDaylight 或 Ryu 等。--topolinear,3,1定义网络拓扑为线性拓扑。参数3,1表示创建 3 个交换机每个交换机下连接 1 台主机。因此最终拓扑是 3 台交换机串联成一条链每台交换机各挂载一台主机。--switchovs,protocolsOpenFlow10指定交换机的类型为 Open vSwitchOVS并设置其使用的 OpenFlow 协议版本为 OpenFlow 1.0。protocolsOpenFlow10强制交换机仅支持 OpenFlow 1.0这对于与仅兼容 1.0 版本的控制器通信是必要的。 验证opendaylight-userrootfeature:list|grepodl-mdsal-apidocs odl-mdsal-apidocs|1.5.0-Carbon|x|odl-controller-1.5.0-Carbon|OpenDaylight :: MDSAL :: APIDOCS opendaylight-userrootfeature:list|grepodl-l2switch-switch-ui odl-l2switch-switch-ui|0.5.0-Carbon|x|l2switch-0.5.0-Carbon|OpenDaylight :: L2Switch :: Switch 浏览器访问81.6.63.100:8181/index.html。用户名和密码都是admin配置下发流表开启HTTP-Server功能h2与h1、h3无法互通mininetshovs-ofctl add-flow s2in_port1,actionsdrop mininetpingallshMininet 的内部命令用于执行后续的 shell 命令即 Linux 系统命令。它允许在 Mininet 提示符下直接运行外部程序。ovs-ofctlOpen vSwitch 的命令行工具用于管理和查看 OpenFlow 流表。add-flow s2向名为s2的交换机添加一条流表项。in_port1,actionsdrop流表项的匹配条件和动作。in_port1匹配条件表示数据包的入端口是交换机的端口 1。actionsdrop动作表示丢弃匹配到的数据包。作用在交换机s2上添加一条 OpenFlow 规则所有从端口 1 进入的数据包都将被直接丢弃不再进行后续处理如转发到其他端口或控制器。 h1开启http服务minineth1 python-mSimpleHTTPServer8080h1指定命令在 Mininet 中的虚拟主机h1上执行。Mininet 允许直接对特定主机运行命令。python -m SimpleHTTPServer 8080python调用 Python 解释器。-m SimpleHTTPServer以模块方式运行 Python 的SimpleHTTPServer模块。该模块是 Python 2 内置的一个简单 HTTP 服务器它会将当前工作目录下的文件通过 HTTP 协议共享出来默认端口为 8000此处指定端口为8080。注意Python 3 中对应的模块为http.server命令应为python3 -m http.server 8080。此处使用的是 Python 2 语法说明当前环境可能默认 Python 版本为 2.x。将命令放入后台执行。这样不会占用当前终端服务器将持续运行直到被手动终止如使用kill命令。 安装测试工具mininetshaptinstall-ywgetmininetshaptinstall-ycurl 测试minineth3wget-Oh1 http://10.0.0.1:8080装测试工具mininetshaptinstall-ywgetmininetshaptinstall-ycurl 测试minineth3wget-Oh1 http://10.0.0.1:8080