[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tcpreplay-users
Subject:    Re: [Tcpreplay-users] exchange src ip and dst ip
From:       Aaron Turner <synfinatic () gmail ! com>
Date:       2016-07-09 15:04:10
Message-ID: CANAZdzVz5VB_7odWBYZt=9j2zJ4Z9frCjzihNQa9xB=iA1vpBA () mail ! gmail ! com
[Download RAW message or body]

pcapy or similar API's are probably the easiest way to do what you're
looking to do.

Honestly, if you're at all familiar with C, you could just hard code
the IP swapping in tcprewrite.  Would basically be about 3 lines of
code (swap IP addresses and then set the flag to force the packet to
have the checksums recalculated).  Just find the tcpedit_packet()
function in src/tcpedit/tcpedit.c.
--
Aaron Turner
https://synfin.net/         Twitter: @synfinatic
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin


On Sat, Jul 9, 2016 at 7:51 AM, Big Strong <fangtuo90@gmail.com> wrote:
> Dual-nic can split the outward traffic and inward traffic, but they can't
> assure the reachable of outward traffic, since the destination IPs are out
> of the inner network. And so the outward traffic would never generates flows
> on the switch. Can tcprewrite modify the packets one by one? Is there such a
> function or API to do that? Anyway, I'm exploring use pcapy to do that.
> Thanks for your reply.
>
> 2016-07-09 22:40 GMT+08:00 Aaron Turner <synfinatic@gmail.com>:
>>
>> Well why not use tcpreplay in dual-nic mode to simulate the hosts on
>> the other side of the network?  You'll have to rewrite the MAC
>> addresses as well of course, but tcprewrite does that too.  Sorry, I
>> don't know enough about OVS to really provide better ideas then that.
>> --
>> Aaron Turner
>> https://synfin.net/         Twitter: @synfinatic
>> Those who would give up essential Liberty, to purchase a little temporary
>> Safety, deserve neither Liberty nor Safety.
>>     -- Benjamin Franklin
>>
>>
>> On Sat, Jul 9, 2016 at 12:01 AM, Big Strong <fangtuo90@gmail.com> wrote:
>> > Yes, I know that. After mapping, I can still not get flows for traffic
>> > from
>> > my inner addresses to outside addresseses, because they are not
>> > reachable
>> > (offline). So my idea is to reverse the src ip and dst ip so that the
>> > outward traffic (payload) can generate flows on OVS. Is there any way to
>> > do
>> > that using tcpreplay?
>> >
>> > 2016-07-09 13:24 GMT+08:00 Aaron Turner <synfinatic@gmail.com>:
>> >>
>> >> Well if your inner IP addresses are contiguous, you could always use
>> >> the --pnat option to map the IP addresses to that range.
>> >> --
>> >> Aaron Turner
>> >> https://synfin.net/         Twitter: @synfinatic
>> >> Those who would give up essential Liberty, to purchase a little
>> >> temporary
>> >> Safety, deserve neither Liberty nor Safety.
>> >>     -- Benjamin Franklin
>> >>
>> >>
>> >> On Fri, Jul 8, 2016 at 5:46 PM, Big Strong <fangtuo90@gmail.com> wrote:
>> >> > Er... Switching ip addr is enough, I'm replaying the traffic in a
>> >> > openvswitch switch, I want the traffic to generate flows, which
>> >> > requires
>> >> > the
>> >> > destination IP to be accessible. I can replace the IP to be addresses
>> >> > in
>> >> > my
>> >> > network, but that means I can only generate flows whose destination
>> >> > is
>> >> > inner
>> >> > IPs, while traffic from these inner IPs still cannot generate flows.
>> >> > And
>> >> > that's why I want to exchange the ip addr, to generate flows for
>> >> > traffic
>> >> > start from inner IPs.
>> >> >
>> >> > 2016-07-09 0:52 GMT+08:00 Aaron Turner <synfinatic@gmail.com>:
>> >> >>
>> >> >> Nope, there isn't any "swap source & dest" option.  I can maybe
>> >> >> sorta
>> >> >> understand swapping the src/dst IP, but I have no idea why anyone
>> >> >> would want to do the same for the port.  Care to share your use
>> >> >> case?
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Aaron Turner
>> >> >> https://synfin.net/         Twitter: @synfinatic
>> >> >> Those who would give up essential Liberty, to purchase a little
>> >> >> temporary
>> >> >> Safety, deserve neither Liberty nor Safety.
>> >> >>     -- Benjamin Franklin
>> >> >>
>> >> >>
>> >> >> On Fri, Jul 8, 2016 at 4:56 AM, Big Strong <fangtuo90@gmail.com>
>> >> >> wrote:
>> >> >> > is it possible to use tcprewrite to exchange the src ip/port and
>> >> >> > dst
>> >> >> > ip/port? I mean exchange all the packets automatically, instead of
>> >> >> > one
>> >> >> > by
>> >> >> > one handcraft modification for each packet.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ------------------------------------------------------------------------------
>> >> >> > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park
>> >> >> > in
>> >> >> > San
>> >> >> > Francisco, CA to explore cutting-edge tech and listen to tech
>> >> >> > luminaries
>> >> >> > present their vision of the future. This family event has
>> >> >> > something
>> >> >> > for
>> >> >> > everyone, including kids. Get more information and register today.
>> >> >> > http://sdm.link/attshape
>> >> >> > _______________________________________________
>> >> >> > Tcpreplay-users mailing list
>> >> >> > Tcpreplay-users@lists.sourceforge.net
>> >> >> > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> >> >> > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ------------------------------------------------------------------------------
>> >> >> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in
>> >> >> San
>> >> >> Francisco, CA to explore cutting-edge tech and listen to tech
>> >> >> luminaries
>> >> >> present their vision of the future. This family event has something
>> >> >> for
>> >> >> everyone, including kids. Get more information and register today.
>> >> >> http://sdm.link/attshape
>> >> >> _______________________________________________
>> >> >> Tcpreplay-users mailing list
>> >> >> Tcpreplay-users@lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> >> >> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------------
>> >> > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in
>> >> > San
>> >> > Francisco, CA to explore cutting-edge tech and listen to tech
>> >> > luminaries
>> >> > present their vision of the future. This family event has something
>> >> > for
>> >> > everyone, including kids. Get more information and register today.
>> >> > http://sdm.link/attshape
>> >> > _______________________________________________
>> >> > Tcpreplay-users mailing list
>> >> > Tcpreplay-users@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> >> > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> >> Francisco, CA to explore cutting-edge tech and listen to tech
>> >> luminaries
>> >> present their vision of the future. This family event has something for
>> >> everyone, including kids. Get more information and register today.
>> >> http://sdm.link/attshape
>> >> _______________________________________________
>> >> Tcpreplay-users mailing list
>> >> Tcpreplay-users@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> >> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> > Francisco, CA to explore cutting-edge tech and listen to tech luminaries
>> > present their vision of the future. This family event has something for
>> > everyone, including kids. Get more information and register today.
>> > http://sdm.link/attshape
>> > _______________________________________________
>> > Tcpreplay-users mailing list
>> > Tcpreplay-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> > Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>>
>>
>> ------------------------------------------------------------------------------
>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
>> present their vision of the future. This family event has something for
>> everyone, including kids. Get more information and register today.
>> http://sdm.link/attshape
>> _______________________________________________
>> Tcpreplay-users mailing list
>> Tcpreplay-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
>> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
>
>
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Tcpreplay-users mailing list
> Tcpreplay-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
> Support Information: http://tcpreplay.synfin.net/trac/wiki/Support

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Tcpreplay-users mailing list
Tcpreplay-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcpreplay-users
Support Information: http://tcpreplay.synfin.net/trac/wiki/Support
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic