7 # Compute the network CIDR from the Netmask
22 *) echo "Error: $dec is not recognized"; exit 1
28 IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
29 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
31 # Configure VPP for vPacketGenerator
32 IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
33 HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
34 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
35 VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
36 GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
39 ifconfig eth0 hw ether $FAKE_HWADDR1
40 ip addr flush dev eth0
42 vppctl tap connect tap111 hwaddr $HWADDR1
43 vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
44 vppctl set int state tap-0 up
46 brctl addif br0 tap111
49 vppctl ip route add 0.0.0.0/0 via $GW
53 # Set br0 with public IP and valid MAC so that Linux will have public network access
54 ifconfig br0 hw ether $HWADDR1
55 ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
56 route add default gw $GW
58 #Adding static arp entry for VPP so that it will be able to send packets to default GW
59 ping -c 1 $VLB_IPADDR &>/dev/null &disown
62 GW_MAC=$(arp -n | grep -w $GW | tr -s ' ' | cut -d' ' -f3)
63 VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3)
65 # If VLB is in our network, we will use its MAC
66 if [ ! -z "$VLB_MAC" ]
68 vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
71 # Add arp entry for default GW
72 vppctl set ip arp tap-0 $GW $GW_MAC
74 # Install packet streams
75 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
76 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
77 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
78 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
79 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
80 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
81 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
82 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
83 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
84 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
86 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
87 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
88 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
89 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
90 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
91 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
92 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
93 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
94 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
95 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
97 vppctl exec /opt/dns_streams/stream_dns1
98 vppctl exec /opt/dns_streams/stream_dns2
99 vppctl exec /opt/dns_streams/stream_dns3
100 vppctl exec /opt/dns_streams/stream_dns4
101 vppctl exec /opt/dns_streams/stream_dns5
102 vppctl exec /opt/dns_streams/stream_dns6
103 vppctl exec /opt/dns_streams/stream_dns7
104 vppctl exec /opt/dns_streams/stream_dns8
105 vppctl exec /opt/dns_streams/stream_dns9
106 vppctl exec /opt/dns_streams/stream_dns10
110 VERSION=$(cat /opt/config/demo_artifacts_version.txt)
111 echo "" > /var/lib/honeycomb/persist/context/data.json
112 echo "" > /var/lib/honeycomb/persist/config/data.json
113 /opt/honeycomb/sample-distribution-$VERSION/honeycomb &>/dev/null &disown
116 # Enable traffic flows
118 chmod +x run_streams_dns.sh
119 ./run_streams_dns.sh &>/dev/null &disown