Example for EMU DNS

390 views
Skip to first unread message

Oded Engel

unread,
Jul 21, 2022, 9:16:57 AM7/21/22
to TRex Traffic Generator
Hi there,

I want to use EMU to create thousands of different DNS query and responses (can be a difference of 1 character, as long as it will prevent my DUT DNS caching).

My hope is that the Trex can be used both as DNS client and server and avoid an external server.

Any good written example of the code for this I can use?
Thanks!!!

Oded

Besart Dollma

unread,
Jul 21, 2022, 10:11:03 AM7/21/22
to TRex Traffic Generator
Shalom Oded,
Yes, Emu does support both client and server side.   
Take a look at the auto play option.
However, since you want thousands of different DNS entries in the server (to avoid caching), it will take some time however to load a big database of entries into the server.
If it takes too much, you can hack a few lines of code and create the database in memory instead of loading it from Python.
Thanks, 
Best

Oded Engel

unread,
Jul 21, 2022, 11:30:21 AM7/21/22
to TRex Traffic Generator
This is great, thanks.
How can I configure it that the DNS queries are send from p0 and the dns resolver is on p1 of the trex? (My DUT is in the middle)

Thanks
Oded

Besart Dollma

unread,
Jul 21, 2022, 12:24:35 PM7/21/22
to TRex Traffic Generator
When creating the namespace, you can specify the port. 
Put all the of clients in P0 in one namespace, their first hop will be their default gateway, your DUT.
Put the resolver in P1 in another namespace, its first hope will once again be your DUT which should redirect the packets.
Thanks,

Oded Engel

unread,
Jul 24, 2022, 8:07:40 AM7/24/22
to TRex Traffic Generator
Thanks, any written example maybe?

Besart Dollma

unread,
Jul 24, 2022, 9:09:33 AM7/24/22
to TRex Traffic Generator
Message has been deleted

Oded Engel

unread,
Jul 26, 2022, 10:33:49 AM7/26/22
to TRex Traffic Generator
Hi Bas,
Thanks a lot for the example that made a lot of sense and helped me a lot.
I am still struggling, I assume due to the fact that I didn't manage to understand where in the code I change the lines so that clients sit behind p0 and resolver behind p1.
Can you help me out please?

Thanks
Oded

Besart Dollma

unread,
Jul 28, 2022, 2:54:46 AM7/28/22
to TRex Traffic Generator

Dar Eini

unread,
Jul 31, 2022, 10:02:51 AM7/31/22
to TRex Traffic Generator

Hi,

We were able to run traffic using the emulator, 

however, we encountered a problem loading our profile file when the rate value in the init JSON was greater than 100.

We need higher rates for our tests, so please let us know if there is any way to achieve that.

 

I attached here the python file we tried to load, along with the error message we got - if we change the rate value to "100", it works.

https://drive.google.com/drive/folders/17xUciJBZ52Vt4uleGtsAh_20-kYLW_By?usp=sharing 


Looking forward to your updates,
thanks a lot,

Dar




ב-יום חמישי, 28 ביולי 2022 בשעה 09:54:46 UTC+3, besi7...@gmail.com כתב/ה:

Besart Dollma

unread,
Jul 31, 2022, 10:57:37 AM7/31/22
to TRex Traffic Generator
You are creating a gigantic profile with an enormous database. I have talked about this in my first comment, please refer to it.
Also note in the doc: https://trex-tgn.cisco.com/trex/doc/trex_emu.html#_tutorial_dns that there is a limitation of the supported types.
Thanks

Oded Engel

unread,
Jul 31, 2022, 1:01:04 PM7/31/22
to TRex Traffic Generator
Thanks man,
Putting aside the unsupported query types, how can we solve the rate issue and the DB size, you said: "it will take some time however to load a big database of entries into the server.
If it takes too much, you can hack a few lines of code and create the database in memory instead of loading it from Python."
Apparently we need to do this.

Thanks

Besart Dollma

unread,
Jul 31, 2022, 3:05:32 PM7/31/22
to TRex Traffic Generator

Dar Eini

unread,
Aug 1, 2022, 9:38:16 AM8/1/22
to TRex Traffic Generator
Although we reduced the database size, the error still occurs when the rate value is greater than 100.

Attached here the new profile file with a smaller DB

https://drive.google.com/drive/folders/1GiM1DF3zBE60K058A5bmmwc6fURyZ4am


,Thanks
Dar

ב-יום ראשון, 31 ביולי 2022 בשעה 17:57:37 UTC+3, besi7...@gmail.com כתב/ה:

Dar Eini

unread,
Aug 2, 2022, 5:01:18 AM8/2/22
to TRex Traffic Generator
Note:
 When loading the dns_auto_play.py file you sent us as an example, the same error message appears when the rate value is greater than 100.
For example with rate value of 150.
ב-יום שני, 1 באוגוסט 2022 בשעה 16:38:16 UTC+3, Dar Eini כתב/ה:

Besart Dollma

unread,
Aug 2, 2022, 3:21:12 PM8/2/22
to TRex Traffic Generator
Hi All, 
Yes this is a known issue. The reason for that is that our timer wheel is set to 10msec per tick. 1sec / 100 pps -> 10 msec.
We developed the auto play for sanity tests and not performance testing.  However there is a simple solution for this too:

In this case we calculate not only the ticks, but how many packets to send each tick. Then on each timer call (OnEvent) we send a burst: https://github.com/cisco-system-traffic-generator/trex-emu/blob/7028f6532d7e40f5885c24ef5b15a22c15cecb6f/src/emu/plugins/ping/ping.go#L325

You can do the same in DNS if you want to. Let me know if you need any help with making the change.
Thanks.  

Dar Eini

unread,
Aug 3, 2022, 3:28:11 AM8/3/22
to TRex Traffic Generator
Thanks! I will try it.
Could you please tell me which file exactly I need to change?
ב-יום שלישי, 2 באוגוסט 2022 בשעה 22:21:12 UTC+3, besi7...@gmail.com כתב/ה:

Besart Dollma

unread,
Aug 3, 2022, 5:50:54 AM8/3/22
to TRex Traffic Generator
The dns_utils.go file that I sent in the previous response. Follow the logic in ping,go and implement the same for dns_utils.go
Then compile and start TRex with the new compiled emu executable.

Besart Dollma

unread,
Aug 3, 2022, 9:08:34 AM8/3/22
to TRex Traffic Generator
Hi, 
Thanks,

Dar Eini

unread,
Aug 3, 2022, 12:47:20 PM8/3/22
to TRex Traffic Generator
Thank you!
This fix indeed solved the problem.

ב-יום רביעי, 3 באוגוסט 2022 בשעה 16:08:34 UTC+3, besi7...@gmail.com כתב/ה:
Message has been deleted

Dar Eini

unread,
Aug 16, 2022, 4:59:18 AM8/16/22
to TRex Traffic Generator
Hello again,
We encountered another problem.
The “hostname_template” parameter in the init JSON limits us from testing specific domain names -
It must include a “%v”, and all DNS requests are sent to the same domain with a different index.

In the end, we want to be able to load a file with all the specific domain names we want to send DNS requests for.
I would be glad if you could help us to achieve that.


Thanks a lot,
Dar

hanoh haim

unread,
Aug 16, 2022, 7:20:25 AM8/16/22
to Dar Eini, TRex Traffic Generator
You can change the EMU server code to support any type of domain

Dar Eini

unread,
Aug 16, 2022, 7:52:17 AM8/16/22
to TRex Traffic Generator
Could you please tell me which file in the EMU server code should I change? 
Or where is the part that loops over the domains in the DNS request?

Thanks

Besart Dollma

unread,
Aug 28, 2022, 7:08:25 AM8/28/22
to TRex Traffic Generator
Hi Dar, 
1. Your first question was how to send different queries so that the DUT won't cache. This can be achieved with the `hostname_template` parameter. I am not sure what you mean by same domain with different index. domain1.com and domain2.com are different domains, even though all that differs between them is the number.
2. Loading a big file is problematic for a real time system, it needs to be done in chunks. You will need to change the Emu code to do it. Start by understanding the code here: https://github.com/cisco-system-traffic-generator/trex-emu/blob/8a77593e7ccc408812b0caa94c0d9341adf6c392/src/emu/plugins/dns/dns.go#L706

Trinh Sy

unread,
Nov 6, 2022, 11:18:08 PM11/6/22
to TRex Traffic Generator
Hi everyone,

Would you guide me how to use dns.go and dns_utils.go with /v3.00/emu/dns_auto_play.py. I am facing 100 rate limitation issue.

Thanks,
Sy

Reply all
Reply to author
Forward
0 new messages