-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup-bess.sh
executable file
·130 lines (112 loc) · 4.11 KB
/
setup-bess.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
OSver=$(uname -r | awk -F '-' '{ print $1 }')
install_docker() {
sudo apt-get update -qq
sudo apt-get install -yqq docker-compose
sudo apt-get install -yqq apt-transport-https ca-certificates \
curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update -qq
sudo apt-get install -yqq docker-ce
sudo systemctl start docker
sudo systemctl enable docker
}
sudo apt-get update -qq
apt-get install -yqq software-properties-common
if [[ "$OSver" = "4.15.0" ]]; then
## Ubuntu 18
sudo apt-get install -yqq make apt-transport-https ca-certificates g++ make \
pkg-config libunwind8-dev liblzma-dev zlib1g-dev libpcap-dev libssl-dev \
libnuma-dev git python python-pip python-scapy libgflags-dev libgoogle-glog-dev \
libgraph-easy-perl libgtest-dev libgrpc++-dev libprotobuf-dev libc-ares-dev \
libbenchmark-dev libgtest-dev protobuf-compiler-grpc dpdk-igb-uio-dkms
fi
if [[ "$OSver" = "4.4.0" ]]; then
## Ubuntu 16
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -qq
sudo apt-get install -yqq apt-transport-https ca-certificates g++ make \
libunwind8-dev liblzma-dev zlib1g-dev libpcap-dev libnuma-dev libgflags-dev \
libgoogle-glog-dev libgtest-dev python pkg-config autoconf libtool cmake clang\
libc++-dev python-pip software-properties-common python-software-properties g++-7 \
libssl-dev libc-ares-dev libprotobuf-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --config gcc
cd /tmp
git clone https://github.com/google/grpc.git
cd grpc
git checkout v1.3.2
git submodule update --init
make -j `nproc` EXTRA_CFLAGS='-Wno-error' HAS_SYSTEM_PROTOBUF=false
sudo make install
cd third_party/protobuf
sudo make install
cd ../benchmark
cmake .
sudo make install
sudo ldconfig
sudo apt-get install -yqq libgraph-easy-perl tcpdump
#pip install --upgrade pip
pip install --user protobuf
pip install --user grpcio
pip install --user scapy
fi
cd ~
git clone https://github.com/NetSys/bess.git
##Note that this action must be done every time the machine is started
# Single Node:
#sudo sysctl vm.nr_hugepages=1024
# For multi-node (NUMA) systems
echo 1024 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
sudo mkdir /mnt/huge
sudo mount -t hugetlbfs nodev /mnt/huge
cd bess
git checkout v0.4.0
./build.py
if [[ "$OSver" = "4.15.0" ]]; then
## Ubuntu 18
sudo modprobe igb_uio
fi
if [[ "$OSver" = "4.4.0" ]]; then
## Ubuntu 16
sudo modprobe uio
sudo insmod deps/dpdk-17.11/build/kmod/igb_uio.ko
fi
## Place interfaces to be used by DPDK down
## Then bind interface to DPDK
IFACES=$(ifconfig -a | grep enp | awk -F ' ' '{ print $1 }')
for IFACE in $IFACES; do
IP=$(ifconfig $IFACE | grep "inet addr" | awk -F ' ' '{ print $2 }' | awk -F ':' '{ print $2 }')
testVal=$( echo $IP | awk -F '.' '{ print $1 }' )
if [[ "$testVal" -eq 128 ]]; then
echo "skip"
else
sudo ifconfig $IFACE down
DPDK_ID=$( bin/dpdk-devbind.py --status | grep $IFACE | awk -F ' ' '{ print $1 }' | awk -F ':' '{ print $2":"$3 }')
echo $DPDK_ID
sudo bin/dpdk-devbind.py -b igb_uio $DPDK_ID
fi
done
## Python dependencies
python -m pip install grpcio
python -m pip install grpcio-tools
cp /users/slab/IoT_Sec_Gateway/bess_conf/McBridge.bess /users/slab/bess/bessctl/conf/
cp /users/slab/IoT_Sec_Gateway/bess_conf/ContBridge.bess /users/slab/bess/bessctl/conf/
CHECK_DOCKER=$(which docker)
if [[ -z CHECK_DOCKER ]]; then
install_docker
fi
if [[ "$OSver" = "4.15.0" ]]; then
sudo systemctl disable apparmor.service --now
sudo service apparmor teardown
fi
## Instructions on starting up BESS
# cd bess/bessctl
# ./bessctl
# daemon start
# run McBridge