Emulación de una red definida por software utilizando MiniNet
Mininet
description
Transcript of Mininet
㈜유미테크
Mininet(개인 PC나 랩탑에 구축된
가상 네트워크 인스턴스 )
1
2
목차
1. Mininet
2. wireshark
3. Mininet 실습
Mininet
3
Mininet
• 정의– 개인 PC 나 랩탑에 구축된 가상 네트워크 인스턴스
• 특징– 실제와 같은 수준의 가상 네트워크 제공– 실행 중인 실제 커널 , 스위치 및 어플리케이션 코드 제공
• 방법– ex) sudo mn –controller=remote,127.0.0.1 –topo=tree,4
• Python 라이브러리– python 프로그래밍을 통한 가상 네트워크 구성 지원
사내전파교육 제목명을 적어주세요 .
4
Mininet – install (http://mininet.org/download/)
• Mininet VM Installation– Mininet VM 이미지 다운 받기 (2.1.0, 2.0.0)– VirtualBOX(free, GPL, 추천 ),
VMware Workstation(Windows or Linux), WMware Fusion(Mac),KVM(free, GPL, linux)
• Native Installation from Source– 소스 다운받기
• git clone git://github.com/mininet/mininet ( git 설치 : sudo apt-get install git )
– Mininet 설치 옵션보기• mininet/util/install.sh –h• -a: Mininet VM 에 포함된 모든 내용 . Open vSwitch 의존성 목록 , OpenFlow wireshark dissector, POX 등등• -nfv: Mininet, OpenFlow switch, Open vSwitch• -s mydir: 설치 디렉토리 설정 . ( 다른 옵션보다 앞부분에 기술 )
– Mininet 설치하기 (-a 사용 )• mininet/util/install.sh –a
– Mininet 설치 후 기본 기능 확인 (sudo mn -h: mininet command help)• sudo mn --test pingall
사내전파교육 제목명을 적어주세요 .
5
Mininet – install Cont’d
• Installation from Package– 기존 하위 버전 삭제
• sudo rm –rf /usr/local/bin/mn /usr/local/bin/mnexec /user/local/lib/python*/*/*mininet* /usr/local/bin/ovs-* /usr/local/sbin/ovs-*
– OS 버전 확인• lsb_release –a
– 패키지 설치하기• Mininet 2.1.0 on Ubuntu 13.10: sudo apt-get install mininet• Mininet 2.0.0 on Ubuntu 13.04: sudo apt-get install mininet• Mininet 2.0.0 on Ubuntu 12.10: sudo apt-get install mininet/quantal-backports• Mininet 2.0.0 on Ubuntu 12.04: sudo apt-get install mininet/precise-backports
– 자동실행되는 openvswitch-controller 정지하기• sudo service openvswitch-controller stop• sudo update-rc.d openvswitch-controller disable
– Mininet 테스트• sudo mn --test pingall
– 작동불가인 경우 , kernel module 다시 빌드• sudo dpkg-reconfigure openvswitch-datapath-dkms• sudo service openflow-switch restart
– 추가기능 설치• git clone git://github.com/mininet/mininet• mininet/util/install.sh -fw
사내전파교육 제목명을 적어주세요 .
6
WIRESHARK - install
• Ubuntu 12.04– wireshark 설치
• sudo apt-get install wireshark
– wireshark 그룹 생성• sudo groupadd wireshark
– 사용자를 wireshark 그룹에 추가• sudo usermod -a -G wireshark {YOUR_USER_NAME}
– dumpcap 파일에 대한 그룹 소유권 변경• sudo chgrp wireshark /usr/bin/dumpcap
– wireshark 그룹에서 dumpcap 파일을 실행할 수 있도록 설정• sudo chmod 750 /usr/bin/dumpcap
– setcap 에 대한 기능 추가 ( 보장 )• sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
– 변경 내용 확인• sudo getcap /usr/bin/dumpcap
• Windows– 경로 : http://www.wireshark.org/download.html
사내전파교육 제목명을 적어주세요 .
7
WIRESHARK - execute
• wireshark 실행– ubuntu: sudo wireshark– windows: ${installed_path}\wireshark.exe
사내전파교육 제목명을 적어주세요 .
UbuntuWin-dows
8
WIRESHARK – capture OpenFlow Packet
• Capture Filter 사용– 첫 화면에서 Capture Options 선택 .
사내전파교육 제목명을 적어주세요 .
Ubuntu
Win-dows
1
2
3
1
2
9
WIRESHARK – capture OpenFlow Packet Cont’d
• 캡쳐된 화면
사내전파교육 제목명을 적어주세요 .
Ubuntu Win-dows
10
WIRESHARK – capture OpenFlow Packet Cont’d
• Expression Filter 사용– Ubuntu: OpenFlow Dissector– Windows: Expression
사내전파교육 제목명을 적어주세요 .
Ubuntu
Win-dows
11
Mininet – 네트워크 구성
• 네트워크 구성– sudo mn --switch ovsk --controller remote,127.0.0.1 --topo
tree,depth=2,fanout=3• 호스트 개수 : fanout depth
• 스위치 개수 :
• Mininet CLI– node 목록 : nodes– link 목록 : net– 모든 node 정보 : dump– node, switch IF 정보 :
${node or switch} ifconfig –a– node, switch Process 정보 :
${node or switch) ps –a– network 상태 확인 :
${node or switch} ping –c ${count} ${node or switch}– link Up/Down: link ${node or switch} ${node or switch} up/down– 종료 : exit
• Mininet clean up– sudo mn -c
사내전파교육 제목명을 적어주세요 .
12
Mininet – 실습
• Python Topology– Add host
• ${var} = self.addHost(${name}, ip=${ip_addr})• ex) host1 = self.addHost("host1", ip="10.0.0.1")
– Add Switch• ${var} = self.addSwitch(${name}, dpid=${datapath_ID})• ex) switch1 = self.addSwitch("switch1", dpid=int2dpid(1))
– Add Link• ${var} = self.addLink(${host_or_switch}, ${host_or_switch})• ex) link1 = self.addLink(host1, switch1)
• Mininet 실행– sudo mn --custom ./custom_topology.py --topo mytopo --
controller=remote,127.0.0.1
• SDN Controller– OpenIRIS 서버 실행 : java –jar Torpedo.jar– Web UI 연결 : http://${controller}:${port}/
사내전파교육 제목명을 적어주세요 .
13
Mininet – 실습 Cont’d
• Mininet CLI by Python– 네트워크 생성
• net = Mininet(controller=lambda a: RemoteController(a, ip=“127.0.0.1”))net.addController(“c0”)
– Add host• ${var} = net.addHost(${name}, ip=${ip_addr})• ex) host1 = net.addHost( " host1 " , ip= " 10.0.0.1 " )
– Add Switch• ${var} = net.addSwitch(${name}, dpid=${datapath_ID})• ex) switch1 = net.addSwitch( " switch1 " , dpid=int2dpid(1))
– Add Link• ${var} = net.addLink(${host_or_switch}, ${host_or_switch})• ex) link1 = net.addLink(host1, switch1)
– 네트워크 구동• net.start()
– Mininet 과 CLI 연결• CLI(net)
– 네트워크 종료• net.stop()
• Mininet 실행– sudo ./custom_topology_cli_sh.py
• SDN Controller– OpenIRIS 서버 실행 : java –jar Torpedo.jar– Web UI 연결 : http://${controller}:${port}/
사내전파교육 제목명을 적어주세요 .
14
Mininet – 실습 Cont’d
• Topology 구성하기
사내전파교육 제목명을 적어주세요 .
15
10. References
• Mininet– http://mininet.org/
• Open IRIS– http://openiris.etri.re.kr/
• NOX (and POX)– http://www.noxrepo.org
• wireshark– http://www.wireshark.org
사내전파교육 제목명을 적어주세요 .