Find the answer to your Linux question:
Results 1 to 10 of 10
Hi All. Help me, please, i have the situation: there is real physical interface eth1, and i have my drive, wich create myeth0 and myeth1. I need, that packets, which ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2007
    Posts
    20

    "bridge" between network interfaces


    Hi All.

    Help me, please, i have the situation:
    there is real physical interface eth1, and i have my drive, wich create myeth0 and myeth1.
    I need, that packets, which kernel send to myeth0 and myeth1, really will be sended throw eth1, and packets, received from eth1, passed to kernel throw myeth0 and myeth1.

    Thank you.

  2. #2
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    I don't know how those myeth? would like in ifconfig.

    I presume they will have their own IP addresses and I don't know if it makes any difference if they have the same or a different MAC adddress from eth1.

    I always worked only with real physical devices and they surely had always a different MAC address.

    On a PC, there is a configuration feature to setup a network bridge. I have never done this, but there must be some Linux HOWTOs on the Internet.

    I you for any reason you don't want or can't do this, you can write a small user application which reads in an endless loop from those network sockets and writes to them, simply by doing a recv() into a buffer and take the same buffer and do a send() with it.
    In this case you can also manipulate the Ethernet packet in every unusual way you wish to.

    A little bit more info is here

    http://www.linuxforums.org/forum/lin...lp-server.html
    Bus Error: Passengers dumped. Hech gap yo'q.

  3. #3
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    there is a bridge utility "brctl" - may be, it can help me?

  4. #4
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    Maybe, depends on your setup and requirements.

    http://www.faqs.org/docs/Linux-HOWTO...STP-HOWTO.html
    Bus Error: Passengers dumped. Hech gap yo'q.

  5. #5
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    How can i create in Linux virtual interfaces?
    And than i will add them and eth1 in bridge (brctl addif ...)

  6. #6
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    Quote Originally Posted by dilbert View Post
    I you for any reason you don't want or can't do this, you can write a small user application which reads in an endless loop from those network sockets and writes to them, simply by doing a recv() into a buffer and take the same buffer and do a send() with it.
    In this case you can also manipulate the Ethernet packet in every unusual way you wish to.
    خي, i have written a small application "net_bridge" and a my network driver "myeth".
    Appication recvfrom "myeth0" (socket PF_PACKET) and send it to socket "eth1". Packet is really transmitted from eth1.

    When packet is arrived from ethernet to eth1, eth1 driver is process it and pass (or not pass) to kernel.
    My Question: must i readfrom "eth1" and sendo "myeth0" in net_bridge application?

  7. #7
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    Quote Originally Posted by KPal View Post
    My Question: must i readfrom "eth1" and sendo "myeth0" in net_bridge application?
    I think so. At least, if you run TCP in both directions. If you would send only UDP packets in one way and never care what the peer responds then maybe not.
    Bus Error: Passengers dumped. Hech gap yo'q.

  8. #8
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    i don't use UDP or TCP, i send packets raw, throw PF_PACKET socket.

    but how send packet to "myeth0"?
    when i sendo(socket_myeth0), the function hard_start_transmit is called, but i dont want to transmit this packet, because i have already receive it from eth1 and must pass it throw myeth0 to kernel.

  9. #9
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    Can't you simply receive in your user application from all sockets and what you don't want to forward to other sockets you simply don't send it, i.e. you don't call send() and let the received packet simply get overwritten by the next received one?
    Bus Error: Passengers dumped. Hech gap yo'q.

  10. #10
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    I have found a method for my problem:
    i create with vconfig two VLANs: eth1.0 and eth1.1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •