linux - 如何使用 JMeter 在 Linux (Ubuntu) 上执行 IP 地址欺骗? (JMeter 未创建绑定(bind) IP)

标签 linux ubuntu networking jmeter

大家好,我在运行 JMeter 脚本时遇到了问题,我在系统上创建了 IP(用于欺骗)。我使用下面的循环通过 ifconfig 分配 IP:

for each in $(seq 41 50); do ifconfig enp4s0: $each 10.20.30.$each; done

之后我执行 ifconfig 命令并获得以下输出:
enp4s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 14:fe:b0:a0:b0:e0  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp4s0:: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 10.20.30.50  netmask 255.0.0.0  broadcast 10.255.255.255
    ether 14:fe:b0:a0:b0:e0  txqueuelen 1000  (Ethernet)

在此之后,我为我的 csv 创建了一个 CSV 配置集,其中包含上述范围内的 IP,然后配置 HTTP 请求以使用 CSV 中的 IP,但是当我运行脚本时,所有请求都失败并出现以下错误:
Response code: Non HTTP response code: java.net.BindException
Response message: Non HTTP response message: Cannot assign requested address (Bind failed)

我只是想知道可能是什么原因造成的,我该如何解决。任何帮助将不胜感激。

最佳答案

问题出在第一个命令中。 : 之后有一个额外的空格,这导致仅添加地址 50。您应该会看到类似以下内容。由于未添加从 41 到 49 的地址,因此 JMeter 会抛出一个错误,即它无法从您的 CSV 绑定(bind)到给定地址。

此外,请确保您可以在添加后 ping 所有 IP 地址。这些都由操作系统命令处理,JMeter 期望 IP 已经存在。

附加信息:Jmeter: IP spoofing not working

root@instance-2:/home/# for each in $(seq 43 49); do ifconfig ens4:$each 10.168.0.$each; done


root@instance-2:/home/# ifconfig
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.3  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::4001:aff:fea8:3  prefixlen 64  scopeid 0x20<link>
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
        RX packets 6251  bytes 3126754 (3.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2067  bytes 312885 (312.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
ens4:43: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.43  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:44: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.44  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:45: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.45  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:46: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.46  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:47: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.47  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:48: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.48  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)
ens4:49: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.168.0.49  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 42:01:0a:a8:00:03  txqueuelen 1000  (Ethernet)

关于linux - 如何使用 JMeter 在 Linux (Ubuntu) 上执行 IP 地址欺骗? (JMeter 未创建绑定(bind) IP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55389920/

相关文章:

php - 如何将 pngquant 设置到 Linux 服务器?

ubuntu zfs 挂载需要延迟吗?

linux - 用于从文件名中删除空格的 Bash 脚本

c# - 指定使用哪些 DNS 服务器来解析 .NET 中的主机名

c# - 在 C# 中从单个网络流发送多种类型的数据

linux - Linux 上的 Vagrant synced_folder NFS 权限问题

linux - RabbitMQ 应用程序安装 -/usr/bin/env : escript: No such file or directory

linux - 如何在 EC2 实例上设置 irod

linux - 在 LAMP 中创建新文件或目录?

java - 将 Java 连接到 PHP 进行多人游戏