forked from spinesystemspublic/documentation
Add fakeping
This commit is contained in:
@@ -74,3 +74,59 @@ net.ipv4.icmp_ratelimit = 100000
|
|||||||
net.ipv4.icmp_msgs_burst=1000
|
net.ipv4.icmp_msgs_burst=1000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Making "fake ping"
|
||||||
|
docker-compose.yaml
|
||||||
|
```
|
||||||
|
version: "2.4"
|
||||||
|
|
||||||
|
services:
|
||||||
|
fakeping:
|
||||||
|
container_name: fakeping
|
||||||
|
build: ./fakeping
|
||||||
|
networks:
|
||||||
|
mgmnt-net:
|
||||||
|
ipv4_address: 10.0.252.19
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
mgmnt-net:
|
||||||
|
name: mgmnt-net
|
||||||
|
driver: macvlan
|
||||||
|
driver_opts:
|
||||||
|
parent: eno1
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: "10.0.252.0/24"
|
||||||
|
gateway: "10.0.252.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Dockerfile in fakeping directory
|
||||||
|
```
|
||||||
|
FROM ubuntu/kinetic:latest
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y iproute2 iputils-ping
|
||||||
|
|
||||||
|
ADD entrypoint2.sh /tmp
|
||||||
|
WORKDIR /root
|
||||||
|
ENTRYPOINT ["/tmp/entrypoint2.sh"]
|
||||||
|
```
|
||||||
|
|
||||||
|
File entrypoint2.sh
|
||||||
|
```
|
||||||
|
#!/bin/sh
|
||||||
|
tc qdisc del dev eth0 root
|
||||||
|
tc qdisc add dev eth0 root handle 1:0 htb default 10
|
||||||
|
tc class add dev eth0 parent 1:0 classid 1:10 htb rate 500Gbit ceil 500Mbit prio 0
|
||||||
|
tc qdisc add dev eth0 parent 1:10 handle 10: pfifo limit 10000
|
||||||
|
tc class add dev eth0 parent 1:0 classid 1:40 est 1sec 8sec htb rate 350Mbit ceil 350Mbit
|
||||||
|
tc qdisc add dev eth0 parent 1:40 handle 41: netem delay 40ms 10ms limit 90000
|
||||||
|
tc filter add dev eth0.11 protocol ip parent 1: prio 1 u32 match ip protocol 0x1 0xff flowid 1:40
|
||||||
|
# while loop
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user