Notes - Network Simulation and Analysis
  • 網路模擬與分析
  • 期中
    • 20210222 Ubuntu 與 Mininet 的安裝
    • 20210308 Iperf
    • 20210315 Gnuplot
    • 20210322 Bridge ( 一 )
    • 20210329 Bridge ( 二 )
    • 20210412 Openvswitch ( 一 )
    • 20210419 期中週
  • 期末
    • 20210426 Group Table
    • 20210503 Containernet / Mininet-Wifi ( Miniedit )
    • 20210510 Programming Protocol-independent Packet Processors ( P4 ) - 1
    • 20210517 Programming Protocol-independent Packet Processors ( P4 ) - 2
    • 20210524 Programming Protocol-independent Packet Processors ( P4 ) - 3
    • 20210531 Programming Protocol-independent Packet Processors ( P4 ) - 4
    • 20210607 Programming Protocol-independent Packet Processors ( P4 ) - Finish
Powered by GitBook
On this page
  • 課堂資料
  • 課堂練習
  • 安裝 pip
  • 額外補充
  • Iperf
  • Gnuplot

Was this helpful?

  1. 期中

20210308 Iperf

Previous20210222 Ubuntu 與 Mininet 的安裝Next20210315 Gnuplot

Last updated 3 years ago

Was this helpful?

課堂資料

課堂練習

安裝 pip

安裝 ppa

add-apt-repository ppa:deadsnakes/ppa

Update packeges

apt-get update
apt-get upgrade

升級 python 2.x 到 python 3.x

apt-get install python3.6
apt-get install python3.6-gdbm
apt-get install python3.7
apt-get install python3.7-gdbm
apt install ansible
python -V
python3 -V

安裝 pip

apt-get install python3-pip
pip3 install --upgrade pip

設定優先順序

update-alternatives --install / usr / bin / python3 python3 /usr/bin/python3.6 1
update-alternatives --install / usr / bin / python3 python3 /usr/bin/python3.7 2

到 pip document 官方網站建議的載點下載 pip 安裝檔

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

啟動剛剛下載好的 get-pip.py 檔案

python3 get-pip.py

查看 pip 目前版本

python3 -m pip -V

額外補充

Part 01.

en
conf t
ho R1
do writ
int e0/2
ip add dhcp
no shut
do sh ip int brief

Part 03.

exit
username cisco privile 15 password cisco
ip domain-name test.com
crypto key generate rsa
ip ssh ver 2
line vty 0 4
login local
transport input ssh

Part 02.

ping 192.168.8.140

Part 04.

ssh cisco@192.168.8.140
conf t
int e0/0
ip add 192.168.1.254 255.255.255.0
no shut
int e0/1
ip add 192.168.2.254 255.255.255.0
no shut
do sh ip int bri
exit
exit
exit
python3 -m  pip install paramiko
python3 -m  pip install --upgrade pip
python3
import paramiko
exit
mkdir cisco
cd cisco
gedit hosts config_cisco.yml

hosts

[cisco]
192.168.8.140 ansible_connection=local

config_cisco.yml

- hosts: 192.168.8.140
  gather_facts: yes
  vars:
    - cisco_host_ip: 192.168.8.140
      ssh_username: cisco
      ssh_password: cisco
      enable_open: yes
      enable_password: cisco
  roles:
     - config_cisco
mkdir config_cisco
cd config_cisco
mkdir tasks
cd tasks
gedit main.yml

main.yml

- name: cisco_description_ssh_certification
  set_fact:
    cisco_verification:
      host: "{{cisco_host_ip}}"
      username: "{{ssh_username}}"
      password: "{{ssh_password}}"
      authorize: "{{enable_open}}"
      auth_pass: "{{enable_password}}"

- name: config e0/0
  ios_config:
      provider: "{{cisco_verification}}"
      parents:  interface Ethernet 0/0     
      lines:
        - ip addr 192.168.1.254 255.255.255.0
        - no shut

- name: config e0/1
  ios_config:
      provider: "{{cisco_verification}}"
      parents:  interface Ethernet 0/1     
      lines:
        - ip addr 192.168.2.254 255.255.255.0
        - no shut

- name: show ip interface
  ios_command:
      provider: "{{cisco_verification}}"
      commands: show ip interface brief
  register: show_ip_log

- name: show_ip_log
  debug:
    var: show_ip_log.stdout_lines
  with_items: show_ip_log.results
cd ..
cd ..
apt install tree
tree
ansible-playbook config_cisco.yml -i hosts
ansible-playbook plyabook.yml -i hosts
cd ..
cd mininet

Iperf

mn
net
xterm h1 h2
pingall
iperf -s -i 1
iperf -s -i 1 -u
iperf -s -i 1 -u -p 6666
  • -p:port

iperf -c 10.0.0.2 -t 20
  • -c:Client

  • -t:Time

iperf -c 10.0.0.2 -t 10 -u -b 100M
iperf -c 10.0.0.2 -t 10 -u -b 100M -p 6666
xterm h1 h2 s1
iperf -s -i 1 -u -p 5555
iperf -c 10.0.0.2 -t 10 -u -b 100M -p 5555
exit
xterm h1 h2
iperf -s -i 1 -u -p 5555 > udp5555
^C
cat udp5555
cat udp5555 | grep sec
cat udp5555 | grep sec | grep -y 0.0-15  
cat udp5555 | grep sec | head -n 14 > result.txt
iperf -c 10.0.0.2 -t 15 -u -b 100M -p 5555
cd mininet
mn
xterm h1 h2
xterm s1
h1 ifconfig
h1 ping 10.0.0.2 -c 3
ping 10.0.0.2
python -m SimpleHTTPServer 80
su - user
firefox
ping 10.0.0.1
10.0.0.2:80
sh ls /tmp
pingall

Gnuplot

apt install gnuplot
exit
gnuplot
plot "result.txt"
set yrange [0:110]
set ytics 0,10,110
replot
set xrange [0:15]
set xtics 0,5,15
plot "result.txt" with linespoints
set xtics 0,1,15
replot
set xlabel "tine (sec)"
set ylabel "throughput (Mbis/sec)"
replot
set title "udp throughput"
replot
set terminal "gif"
type set to 'gif'
set output "result.gif"
replot
exit
How to Install Python on Ubuntu Linux - Website for StudentsWebsite for Students
Iperf使用說明 @ Martin Chang的部落格 :: 痞客邦 ::Martin Chang的部落格
Logo
Iperf command and usage
GitHub - p4lang/behavioral-model: The reference P4 software switchGitHub
Logo
669B
cisco.tar.gz
3MB
20210308.pptx
Mininet 指令
Logo
Logo