Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

raw - Inject any frame in ethernet interface through sockets C

I am working on a solution in which I need to resend all original frames received from one ethernet interface to a different ethernet interface. I am able to sniff all received frames in the first ethernet interface (enp0s8) (using socket RAW in C), as Wireshark works, and I am able to resend this frame to the other ethernet interface, enp0s9, and I can see it with Wireshark, internally. However, this frame is not sent out to the internal network which enp0s9 belongs to.

The test scenario consists on three VM (VBox):

  • the first one, VM1, from where I send frames. One network adapter, internal network (intnet1), IP: 192.168.1.1.
  • the second one, VM2, where my code is running, with two eth.interfaces (enp0s8 and enp0s9). both network adapters as internal network. enp0s8: IP: 192.168.1.254, intnet1. enpos9: IP: 192.168.2.254, intnet2.
  • the third one, VM3, where I am waiting for frames resent by my app running in VM2.One network adapter, internal network (intnet2), IP: 192.168.2.1.
  • Ping VM1 <-> VM2 Works. Ping VM2 <-> VM3 works.

I would like to resend any frame (with any Ethernet Header and any IP header) to enp0s9 and the internal network intnet2.

Thanks in advance ;)

question from:https://stackoverflow.com/questions/66063580/inject-any-frame-in-ethernet-interface-through-sockets-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...