ubuntu20.04下P4环境搭建

一、 安装全新的ubuntu20.04 虚拟环境

下载链接:https://cn.ubuntu.com/download/alternative-downloads

ubuntu20.04下P4环境搭建_第1张图片 下载ubuntu20.04 桌面版 

接下来是vmware安装ubuntu20.04,这里直接略过,网上有很多教程。 

二、 安装运行环境

0. 准备工作

1. 参考链接: https://blog.csdn.net/weixin_42896572/article/details/110000147

2. 拉取github仓库到gitee

github:https://github.com/google/protobuf

github:https://github.com/mininet/mininet

gitee上新建仓库,并点击导入:

ubuntu20.04下P4环境搭建_第2张图片

输入github上仓库的url,并点击导入

ubuntu20.04下P4环境搭建_第3张图片

设置为公开:

ubuntu20.04下P4环境搭建_第4张图片

 mininet仓库设置同上。

 

 

 

1. 安装

mkdir p4_env
cd p4_env
sudo apt install git
sudo apt install pip 
sudo apt install python 
sudo apt install python2
git clone https://gitee.com/(自己的名字)/p4-guide
sudo ./p4-guide/bin/install-p4dev-v5.sh |& tee log.txt

执行sh脚本前,需要将脚本中github的路径改为gitee的路径:

  • https://github.com/mininet/mininet 替换成 https://gitee.com/自己的名字/mininet

显示如下表示安装成功! 

ubuntu20.04下P4环境搭建_第5张图片

2. 测试

在p4_env目录下

git clone https://github.com/p4lang/tutorials
cd tutorials/exercises/basic
sudo cp solution/basic.p4 basic.p4
sudo pip3 install mininet
sudo make run 

成功截图如下:

ubuntu20.04下P4环境搭建_第6张图片

 进行测试:

h1 ping h2

成功截图如下:

ubuntu20.04下P4环境搭建_第7张图片

exit退出mininet,此时就安装完成了!

 

你可能感兴趣的:(环境配置,开发语言)