I have an issue. My task is the following: I have to capture tcp packets on my first ethernet card which is connected to a subnet. (ip addr on this ethernet card 192.168.137.33) after that I have to redirect this packets to the other subnet via my second
ethernet card occording to a rule. (ip addr on this ethernet card 126.96.36.199).
What I did. I captured the packet on the first ethernet card. Copied the ethernet - ipv4 layers and the payload. I changed the source IP to the IP of my secondary ethernet card, I created a new tcp packet with PacketBuilder and sended over the second ethernet
I tested with ftp connection creation. If I try to direct create a ftp connection than it is working (goes the sync and ack packets) but if I use my "proxy" it did not works. The sync goes out but I did not get the resp ack packets. I compared
with wireshark it seems the the packet structure is same in both methods. (If I use Internet Connection Service than this works as well)
EthernetLayer elayer = (EthernetLayer)packet.Ethernet.ExtractLayer();
IpV4Layer ilayer = (IpV4Layer)packet.Ethernet.IpV4.ExtractLayer();
ilayer.Source = new IpV4Address(mainIP);
ilayer.HeaderChecksum = null;
PayloadLayer payload = (PayloadLayer)new Datagram(packet.Ethernet.IpV4.Payload.ToMemoryStream().ToArray()).ExtractLayer();
Packet p2 = PacketBuilder.Build(DateTime.Now, elayer, ilayer, payload);
I tried to change the Mac Addresses as well but the result was same.
thx for the help