H3C模擬延時測試ping包

KuangZhuMing2發表於2024-06-07

1.拓撲

2.各路由器配置

sysname R1

ospf 1
 area 0.0.0.0
  network 10.0.12.0 0.0.0.255
  network 10.0.13.0 0.0.0.255

interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
 ospf 1 area 0.0.0.0

interface GigabitEthernet0/0
 ip address 10.0.12.1 255.255.255.0

interface GigabitEthernet0/1
 ip address 10.0.13.1 255.255.255.0

 ip route-static 2.2.2.2 32 10.0.13.3 preference 9
 sysname R2

ospf 1
 area 0.0.0.0
  network 10.0.12.2 0.0.0.0
  network 10.0.24.2 0.0.0.0

interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
 ospf 1 area 0.0.0.0

interface GigabitEthernet0/0
 ip address 10.0.12.2 255.255.255.0

interface GigabitEthernet0/1
 ip address 10.0.24.2 255.255.255.0
sysname R3

ospf 1
 area 0.0.0.0
  network 10.0.13.3 0.0.0.0
  network 172.17.21.0 0.0.0.255

interface GigabitEthernet0/0
 ip address 10.0.13.3 255.255.255.0

interface GigabitEthernet0/1
 ip address 172.17.21.5 255.255.255.0

ip route-static 2.2.2.2 32 172.17.21.28 preference 9

sysname R4

ospf 1
 area 0.0.0.0
  network 10.0.24.4 0.0.0.0
  network 172.17.20.4 0.0.0.0

interface GigabitEthernet0/0
 ip address 172.17.20.4 255.255.255.0

interface GigabitEthernet0/1
 ip address 10.0.24.4 255.255.255.0

3.伺服器配置與測試

#伺服器物理網路卡
[root@yt-hz-kvm01 ~]# brctl show br0
bridge name	bridge id		STP enabled	interfaces
br0		8000.0025909be920	yes		eth2

#新增2個IP網段
ip add a 172.17.20.28/26 dev br0
ip add a 172.17.21.28/24 dev br0

#新增ospf配置檔案
[root@yt-hz-kvm01 ~]# cat /etc/quagga/ospfd.conf 
router ospf
 ospf router-id 172.17.21.28
 network 172.17.20.0/24 area 0.0.0.0
 network 172.17.21.0/24 area 0.0.0.0

#啟動ospf程序
systemctl restart ospfd

#檢視ospf鄰居與路由
檢視ospf鄰居

檢視ospf路由

檢視路由

#新增延時100ms

[root@yt-hz-kvm01 ~]# tc qdisc add dev eth2 root  netem delay 100ms

#R1和r3上面增加2.2.2.2的靜態路由,優先順序要比ospf學到的高
#R1
ip route-static 2.2.2.2 32 10.0.13.3 preference 9

#R3
ip route-static 2.2.2.2 32 172.17.21.28 preference 9

#測試(在r2路由器上面指定環回口測試,此時由於來回路徑不一致,回去的流量是經過了伺服器埠)

#刪除延時100ms

tc qdisc del dev eth2 root  netem delay 100ms

相關文章