wtorek, lipca 30, 2013

Simulate long distance data center connection

[root@eai-node-01 ~]# modprobe sch_netem; tc qdisc add dev bond0 root netem delay 10ms  5ms 25%
[root@eai-node-01 ~]# ping eai-node-02.local
PING eai-node-02.local (192.168.100.202) 56(84) bytes of data.
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=1 ttl=64 time=14.5 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=2 ttl=64 time=11.6 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=3 ttl=64 time=9.37 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=4 ttl=64 time=14.5 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=5 ttl=64 time=14.8 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=6 ttl=64 time=14.0 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=7 ttl=64 time=13.9 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=8 ttl=64 time=11.7 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=9 ttl=64 time=11.3 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=10 ttl=64 time=10.1 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=11 ttl=64 time=7.36 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=12 ttl=64 time=6.50 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=13 ttl=64 time=7.04 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=14 ttl=64 time=9.13 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=15 ttl=64 time=14.0 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=16 ttl=64 time=9.01 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=17 ttl=64 time=6.72 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=18 ttl=64 time=9.01 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=19 ttl=64 time=9.53 ms
^C
--- eai-node-02.local ping statistics ---
53 packets transmitted, 53 received, 0% packet loss, time 52133ms
rtt min/avg/max/mdev = 5.188/10.388/14.837/2.724 ms
[root@eai-node-01 ~]# tc qdisc del root dev bond0
[root@eai-node-01 ~]# tc qdisc
qdisc mq 0: dev eth0 root
qdisc mq 0: dev eth1 root
[root@eai-node-01 ~]# ping eai-node-02.local
PING eai-node-02.local (192.168.100.202) 56(84) bytes of data.
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=1 ttl=64 time=0.161 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=2 ttl=64 time=0.172 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=3 ttl=64 time=0.139 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=4 ttl=64 time=0.145 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=5 ttl=64 time=0.162 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=6 ttl=64 time=0.133 ms
^C
--- eai-node-02.local ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5983ms
rtt min/avg/max/mdev = 0.133/0.152/0.172/0.013 ms


[root@eai-node-01 ~]# tc qdisc add dev bond0 root netem loss 30% 25%
[root@eai-node-01 ~]# ping eai-node-02.local
PING eai-node-02.local (192.168.100.202) 56(84) bytes of data.
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=1 ttl=64 time=0.157 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=2 ttl=64 time=0.138 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=3 ttl=64 time=0.204 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=4 ttl=64 time=0.174 ms

[root@eai-node-01 ~]# tc qdisc del root dev bond0
[root@eai-node-01 ~]# tc qdisc add dev bond0 root netem delay 10ms reorder 25% 50%
[root@eai-node-01 ~]# ping eai-node-02.local
PING eai-node-02.local (192.168.100.202) 56(84) bytes of data.
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=1 ttl=64 time=10.2 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=2 ttl=64 time=10.2 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=3 ttl=64 time=0.153 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=4 ttl=64 time=10.1 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=5 ttl=64 time=7.88 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=6 ttl=64 time=10.1 ms
64 bytes from eai-node-02.local (192.168.100.202): icmp_seq=7 ttl=64 time=10.2 ms

[root@eai-node-02 ~]# modprobe ifb
[root@eai-node-02 ~]# ip link set dev ifb0 up
[root@eai-node-02 ~]# tc qdisc add dev bond0 ingress
[root@eai-node-02 ~]# tc filter add dev bond0 parent ffff: protocol ip u32 match ip dport 7789 0xffff flowid 1:1 action mirred egress redirect dev ifb0
Action 4 device ifb0 ifindex 5
[root@eai-node-02 ~]# tc qdisc add dev ifb0 root netem delay 7ms

0 komentarze: