测试网关的最简单方法是什么? [英] What's the easiest way to test a gateway?

查看:473
本文介绍了测试网关的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试我编写的玩具网关.测试将在Linux机器上进行.我想以最简单的方式做到这一点,理想情况下不编写任何代码并使用现有的实用程序.这归结为两个问题:

I want to test a toy gateway I wrote. The testing will occur on Linux machines. I would like to do this in the easiest way possible, ideally writing no code and using existing utilities. This boils down to two questions:

  1. 是否存在现有的实用程序,可以通过用户指定的网关将其中包含简单内容(例如我提供的字符串)的数据包发送到主机,而无需重新配置Linux的网络设置?如果是这样,我将对该实用程序使用哪种语法?

  1. Is there an existing utility that can send packets with simple stuff in them(like a string that I supply) to a host through a user-specified gateway, without reconfiguring Linux's network settings? If so, what syntax would I use for the utility?

是否可以在接收端运行一个简单的实用程序,以验证是否接收到正确的数据包?如果是这样,我将对该实用程序使用哪种语法?

Is there a simple utility I can run on the receiving end to verify that the correct packet was received? If so, what syntax would I use for the utility?

推荐答案

我不知道第一个,但是我认为修改路由表并不那么困难:

I don't know about the first, but I don't think it's that hard to modify your routing table:

route add -host 1.2.3.4 gw 5.6.7.8

(用目标IP替换1.2.3.4,用网关IP替换5.6.7.8).

(replace 1.2.3.4 by your target IP and 5.6.7.8 by the IP of your gateway).

对于2 .: 在目标服务器上,键入netcat -l 1234,然后在客户端上,键入netcat 1.2.3.4 1234. (1234是一个随机"端口号)(取决于您的分布,netcat可能被称为简单的"nc".)如果建立了连接,则只需在客户端或服务器计算机上键入数据,请按Enter键并查看数据到达在另一台机器上.

For 2.: On the target server type netcat -l 1234 and on the client then type netcat 1.2.3.4 1234. (1234 is a "random" port number)(depending on your distribution netcat might be called simple "nc".) If a connection gets established you can just type data on the client or the server machine, press enter and see the data arriving on the other machine.

这篇关于测试网关的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆