SDN实验搭建-安装(Mininet+Ryu)

一、安装git

1
2
3
su root//这步忽略吧,尽量别进root模式

sudo apt-get install git

image-20230413002711167

二、Mininet的安装

1
2
3
4
5
6
7
8
9
git clone https://github.com/mininet/mininet.git

cd mininet

ls //查看目录

cd util

./install.sh -n3v //这步会有警告,忽略吧

image-20230413004011607

image-20230413004125985

image-20230413013757728

注意mn命令要在root账户或者sudo权限下。

image-20230413013946900

输入pingall 来检查网络的连通性。

在安装RYU之前,需要安装pip。

1
2
3
wget https://bootstrap.pypa.io/get-pip.py

python get-pip.py //最低版本python3.7,安装python3.8的教程在下面

image-20230413014424613

安装Python 3.8 可以按照以下步骤在 Ubuntu 16.04 上进行:

  1. 确认系统已经安装了必要的依赖库:

    1
    2
    3
    4
    5
    6
    sudo apt-get update

    sudo apt-get install build-essential checkinstall

    sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
  2. 下载 Python 3.8 的源代码包:

    1
    2
    3
    cd /opt

    sudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
  3. 解压源代码包:

    1
    sudo tar xzf Python-3.8.0.tgz
  4. 编译源代码:

    1
    2
    3
    4
    5
    cd Python-3.8.0

    sudo ./configure --enable-optimizations

    sudo make altinstall

    这里使用 make altinstall 命令安装 Python 3.8 而不是 make install 命令,是为了避免破坏系统自带的 Python 2.7。

  5. 安装完成后,可以使用以下命令来验证 Python 3.8 是否安装成功:

    1
    python3.8 --version

    如果显示 Python 3.8.x 的版本号,则说明安装成功。

    直接python3.8 get-pip.py

image-20230413014739839

三、安装RYU

1
git clone https://github.com/osrg/ryu.git

image-20230413022321411

1
2
3
4
5
6
7
8
cd ryu

ls

pip install -r tools/pip-requires //安装之前,先安装所需要的依赖



image-20230413022623674

image-20230413022659637

1
python setup.py install //安装ryu 出错的话,用python3.8

image-20230413023446793

验证RYU是否安装成功

1
2
3
4
5
6
7
8
9
10
cd ryu

ls

cd app

ryu-manager example_switch_13.py //先别回车,另一个终端先提前输好命令

mn --controller=remote //另一个终端敲的命令,使用远端控制器,这个命令在后面。

image-20230413024025036

image-20230413024039692

输入pingall

image-20230413024325990

如何启动mininet的可视化界面

1
2
3
4
5
6
7
8
9
10
cd mininet

ls

cd examples

ls

./miniedit.py

image-20230413024550577