UOS安装及配置SDN
题目:
一、配置好apt源,安装相关软件
挂载目录 root@skills-PC:~# mount /dev/sr0 /mnt/ mount: /mnt: WARNING: device write-protected, mounted read-only. 编辑文件 root@skills-PC:~# vim /etc/apt/sources.list deb [trusted=yes] file:///mnt fou main
跟新源并下载jdk和mininet
root@skills-PC:~# apt-get update
root@skills-PC:~# apt install openjdk-8-jdk mininet -y
二、上传并解压opendaylight,并启动karaf程序
使用winSCP上传安装包
解压安装包 root@ispsrv:~/ unzip -d / distribution-karaf-0.6.0-Carbon.zip 进入目录 root@ispsrv:~# cd /distribution-karaf-0.6.0-Carbon/bin/ 写入jdk环境变量 root@ispsrv:~distribution-karaf-0.6.0-Carbon/bin# echo 'JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"' >> setenv 启用软件 root@skills-PC:/distribution-karaf-0.6.0-Carbon/bin# ./start root@skills-PC:/distribution-karaf-0.6.0-Carbon/bin# ./client ####这里需要等待一下在输入
三、安装组件
opendaylight-user@root>feature:install odl-restconf odl-l2switch-switch-ui odl-mdsal-apidocs odl-dluxapps-applications
四、建立拓扑
opendaylight-user@root>logout root@skills-PC:/distribution-karaf-0.6.0-Carbon/bin# mn --controller=remote,ip=127.0.0.1,port=6653 --topo=linear,3 --switch default,protocols=OpenFlow10 mininet> pingall *** Ping: testing ping reachability h1 -> h2 h3 h2 -> h1 h3 h3 -> h1 h2 *** Results: 0% dropped (6/6 received) mininet>
五、下发流表
mininet> sh ovs-ofctl add-flow s2 in_port=1,actions=drop 实现h2与h1,h3无法互通 mininet> pingall *** Ping: testing ping reachability h1 -> X h3 h2 -> X X h3 -> h1 X *** Results: 66% dropped (2/6 received) mininet>
六、启动HTTP-Server功能
mininet> h1 python -m SimpleHTTPServer 8080 & mininet> sh apt install wget -y mininet> h3 wget 10.0.0.1:8080 --2022-07-20 12:52:56-- http://10.0.0.1:8080/ Connecting to 10.0.0.1:8080... connected. HTTP request sent, awaiting response... 200 OK Length: 1052 (1.0K) [text/html] Saving to: ‘index.html’ index.html 100%[===================>] 1.03K --.-KB/s in 0s 2022-07-20 12:52:56 (123 MB/s) - ‘index.html’ saved [1052/1052] mininet>