python模拟多ip_模拟多个IP地址进行测试

为测试客户端软件,需要构建一个模拟器,它能模拟多个IP地址在同一端口上,以模拟电机控制服务器网络。问题涉及到如何在没有多个网络接口卡的情况下,使模拟器接受并响应来自不同IP的连接。提出了使用Bonjour服务发现、在同一NIC上分配多个IP地址和使用VMWare创建虚拟系统的解决方案。
摘要由CSDN通过智能技术生成

I need to simulate multiple embedded server devices that are typically used for motor control. In real life, there can be multiple servers on the network and our desktop software acts as a client to all the motor servers simultaneously. We have a half-dozen of these motor control servers on hand for basic testing, but it's getting expensive to test bigger systems with the real hardware. I'd like to build a simulator that can look like many servers on the network to test our client software.

How can I build a simulator that will look like it has many IP addresses on the same port without physically having many NIC's. For example, the client software will try to connect to servers 192.168.10.1 thru 192.168.10.50 on port 1111. The simulator will accept all of those connections and run simulations as if it were moving physical motors and send back simulated data on those socket connections.

Can I use a router to map all of those addresses to a single testing server, or ideally, is there a way to use localhost to 'spoof' those IP addresses? The client software is written in .Net, but Python ideas would be welcomed as well.

解决方案

A. consider using Bonjour (zeroconf) for service discovery

B. You can assign 1 or more IP addresses the same NIC:

On XP, Start -> Control Panel -> Network Connections and select properties on your NIC (usually 'Local Area Connection').

Scroll down to Internet Protocol (TCP/IP), select it and click on [Properties].

If you are using DHCP, you will need to get a static, base IP, from your IT.

Otherwise, click on [Advanced] and under 'IP Addresses' click [Add..]

Enter the IP information for the additional IP you want to add.

Repeat for each additional IP address.

C. Consider using VMWare, as you can configure multiple systems and virtual IPs within a single, logical, network of "computers".

-- sky

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值