Source MAC address per IP packet - Networking

This is a discussion on Source MAC address per IP packet - Networking ; Hello, for a networking application, I need to set the source MAC address individually for every IP packet that I send. Is this possible at all? I know that the MAC address can be changed in software but per IP ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Source MAC address per IP packet

  1. Source MAC address per IP packet

    Hello,

    for a networking application, I need to set the source MAC address
    individually
    for every IP packet that I send. Is this possible at all? I know that
    the MAC address
    can be changed in software but per IP frame? On the other hand, every
    layer 2
    switch does exactly this, so it must be possible in principle. Do I
    need special
    network controller chips that support this feature? All datasheets of
    ethernet
    controllers I got hands on allow you to program the MAC address but it
    is then
    automatically filled in for every packet.

    Also, how would the programming side look like? I presume I must use
    RAW sockets
    but in which field would I set the source MAC address?

    Thanks,

    Albrecht

  2. Re: Source MAC address per IP packet

    On Jun 15, 3:02*pm, albrechtuhlm...@gmx.net wrote:
    > Hello,
    >
    > for a networking application, I need to set the source MAC address
    > individually
    > for every IP packet that I send. Is this possible at all? I know that
    > the MAC address
    > can be changed in software but per IP frame? On the other hand, every
    > layer 2
    > switch does exactly this, so it must be possible in principle. Do I
    > need special
    > network controller chips that support this feature? All datasheets of
    > ethernet
    > controllers I got hands on allow you to program the MAC address but it
    > is then
    > automatically filled in for every packet.
    >
    > Also, how would the programming side look like? I presume I must use
    > RAW sockets
    > but in which field would I set the source MAC address?
    >
    > Thanks,
    >
    > Albrecht


    Albrecht,

    For what practical, benevolent purpose would you ever need to do
    this!?

    hat trick

  3. Re: Source MAC address per IP packet

    hat-trick writes:

    >For what practical, benevolent purpose would you ever need to do this!?


    What about replaying network traces to test (possibly modified)
    packet filter rules? What about generating specifically formatted
    packets to test such rules where they try to match MAC addresses
    (whatever good that would do)? What about testing layer 2 switch
    MAC table overflow characteristics?

    best regards
    Patrick

  4. Re: Source MAC address per IP packet

    On Aug 10, 10:51*am, hat-trick wrote:

    > Albrecht,
    >
    > For what practical, benevolent purpose would you ever need to do
    > this!?


    Aside from all the others suggested, the most obvious would be if you
    are implementing a transparent layer 2 switch/bridge.

    DS


  5. Re: Source MAC address per IP packet


    On Jun 15, 3:02 pm, albrechtuhlm...@gmx.net wrote:

    >for a networking application, I need to set the source
    > MAC address individually for every IP packet that I send.
    > Is this possible at all? I know that the MAC address
    > can be changed in software but per IP frame?


    As far as I know, in some the whole packet is generated
    in memory (or in NIC memory) and then sent, in others the
    source address is stuffed in as it is transmitted.

    You might look at older ones from the days when hardware
    was more expensive. (Eight bit ISA days.)

    You should be working at the hardware level, though,
    not while running a networking OS. (DOS makes it easy,
    especially if you never return.)

    Otherwise, just write the source address register
    before sending each packet. (Again, working directly
    with the hardware registers, not through a
    networking OS.

    You want the data sheet for the individual controller
    chip, not the whole card.

    -- glen


  6. Re: Source MAC address per IP packet

    Am Sun, 10 Aug 2008 10:51:49 -0700 schrieb hat-trick:

    > On Jun 15, 3:02*pm, albrechtuhlm...@gmx.net wrote:


    >> for every IP packet that I send. Is this possible at all? I know that
    >> the MAC address
    >> can be changed in software but per IP frame? On the other hand, every
    >> layer 2
    >> controllers I got hands on allow you to program the MAC address but it
    >> is then
    >> automatically filled in for every packet.
    >>
    >> Also, how would the programming side look like? I presume I must use
    >> RAW sockets
    >> but in which field would I set the source MAC address?
    >>


    What about /usr/src/linux/if_ether.h ?
    (struct ethhdr)

    You can set the MAC address to what ever you want.

    cheers

+ Reply to Thread