Batfish Linux下环境搭建

一、环境需求:

  • Java 8 JDK (untested with Java 9, and known incompatibilities with Java 10)
  • maven (3.3.9+)
  • wget (Linux only)
  • unzip (Linux only)
  • git
  • binutils (strip for install_z3.sh)

二、maven安装及简单命令

1.maven的安装

  • 下载解压:
$ wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
$ tar -xvf  apache-maven-3.3.9-bin.tar.gz
$ sudo mv -f apache-maven-3.3.9 /usr/local/
  • 编辑 /etc/profile 文件 sudo vim /etc/profile,在文件末尾添加如下代码:
$ export MAVEN_HOME=/usr/local/apache-maven-3.3.9
$ export PATH=${PATH}:${MAVEN_HOME}/bin
  • 保存文件,并运行如下命令使环境变量生效:
$ source /etc/profile
  • 在控制台输入如下命令,如果能看到 Maven 相关版本信息,则说明 Maven 已经安装成功:
$ source /etc/profile

2.maven的简单命令

$ mvn clean
$ mvn compile
$ mvn test
$ mvn package
$ mvn install

三、Java JDK安装

下载连接:https://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html

现在从Oracle官网下载JDK需要使用账号下载。用户名 [email protected] 密码:Kn123123

$ tar  -zxvf  jdk-8u221-linux-x64.tar.gz
$ cd /usr/local
$ mv /home/cmfchina/jdk1.8.0_221 /usr/local
$ vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
$ source /etc/profile

四、Batfish简单安装

Batfish运行为客户端+服务端

1.服务端(第一种方式)

docker pull batfish/allinone

docker run -v batfish-data:/data -p 8888:8888 -p 9997:9997 -p 9996:9996 batfish/allinone

2.服务端(第二种方式)

相关连接:https://github.com/batfish/batfish/wiki/Building-and-running-Batfish-service

(1)Git batfish

$ git clone https://github.com/batfish/batfish.git
$ cd batfish

(2)安装z3

$ sudo tools/install_z3.sh

(3)添加batfish命令

$ source tools/batfish_functions.sh

(4)编译batfish

$ batfish_build_all

(5)运行batfish服务

allinone -runclient false

3.客户端

相关连接https://github.com/batfish/pybatfish

安装客户端+启动客户端

$ python3 -m pip install --upgrade pip
$ python3 -m pip install --upgrade git+https://github.com/batfish/pybatfish.git
$ python3 -m pip install jupyter

启动方式1

$ jupyter notebook 

启动方式2

$ python3

此链接为python3启动方式的说明文档https://pybatfish.readthedocs.io/en/latest/quickstart.html

 

你可能感兴趣的:(Batfish网络配置验证工具)