-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathveth_setup.sh
executable file
·35 lines (32 loc) · 1013 Bytes
/
veth_setup.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
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "ERROR: This script requires root privileges. Please, use sudo"
exit 1
fi
noOfVeths=64
if [ $# -eq 1 ]; then
noOfVeths=$1
fi
echo "No of Veths is $noOfVeths"
let "vethpairs=$noOfVeths/2"
last=`expr $vethpairs - 1`
veths=`seq 0 1 $last`
# add CPU port
veths+=" 125"
for i in $veths; do
intf0="veth$(($i*2))"
intf1="veth$(($i*2+1))"
if ! ip link show $intf0 &> /dev/null; then
ip link add name $intf0 type veth peer name $intf1 &> /dev/null
fi
ip link set dev $intf0 up
sysctl net.ipv6.conf.$intf0.disable_ipv6=1 &> /dev/null
sysctl net.ipv6.conf.$intf1.disable_ipv6=1 &> /dev/null
ip link set dev $intf0 up mtu 10240
ip link set dev $intf1 up mtu 10240
TOE_OPTIONS="rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash"
for TOE_OPTION in $TOE_OPTIONS; do
/sbin/ethtool --offload $intf0 "$TOE_OPTION" off &> /dev/null
/sbin/ethtool --offload $intf1 "$TOE_OPTION" off &> /dev/null
done
done