Networking Forums

Networking Forums > Computer Networking > Linux Networking > Packet Forwarding and mirroring

Reply
Thread Tools Display Modes

Packet Forwarding and mirroring

 
 
george
Guest
Posts: n/a

 
      12-08-2005, 05:09 PM
I'm trying to get some multicast packets moving between 4 machines
connected with different interfaces.

I'm using these two java scripts to generate the packets:

import sun.net.*;
import java.net.*;


public class Client
{
public static void main(String [] arstring) throws Exception
{
String ip = "224.2.2.2";
for (int i=1; i<=100; i++)
{
try
{
// Create a datagram package and send it to the multicast
byte [] arb = {'H','e','l','l','o'};

InetAddress inetAddress = InetAddress.getByName(ip);
DatagramPacket datagramPacket =
new DatagramPacket(arb, arb.length, inetAddress, 7777);

MulticastSocket multicastSocket = new MulticastSocket();
multicastSocket.setTimeToLive(10);

multicastSocket.send(datagramPacket);
System.out.println(i + ": sending "+ new String(arb));
Thread.sleep(100);
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}
}


<<And this one>>

import sun.net.*;
import java.net.*;

public class Server
{
public static void main(String [] arstring)
{
String ip = "224.2.2.2";
try
{
// Create a multicast datagram socket for receiving IP
// multicast packets. Join the multicast group at
// 230.0.0.1, port 7777.
MulticastSocket multicastSocket = new MulticastSocket(7777);
InetAddress inetAddress = InetAddress.getByName(ip);
multicastSocket.joinGroup(inetAddress);
System.out.println("Listening on " + ip + ":7777");
// Loop forever and receive messages from clients. Print
// the received messages.
while (true)
{
byte [] arb = new byte [100];
DatagramPacket datagramPacket = new DatagramPacket(arb,
arb.length);
multicastSocket.receive(datagramPacket);
String s = new String(arb);
System.out.println(s);
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}


I add the interfaces needed for multicast traffic to 224.0.0.0 on both
linux machines:

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth1
route add -net 224.0.0.0 netmask 240.0.0.0 dev ppp0

I have two windows laptops connected to the linux boxes via ethernet,
the linux boxes are connected via PPP.

When I run the scripts anywhere, they're only recieved by whatever
device is listed first in the routing table. So if ppp0 is listed above
eth1, and I start the script on a linux machine, they're recieved ONLY
by the second linux box because they're connected via ppp. If I start
the script on a linux box, and eth1 is first up, then it's recieved by
the locally attached laptop ONLY.

I have NAT/ICS set up on the linux machines. I can ping every device,
from any device (laptop to laptop, linux box to remote laptop, etc). I
can access shares everywhere and FTP to any device. I just cannot get
these packets to go to every machine simultaneously.

Any thoughts on how this could be accomplished?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
packet forwarding query rahul8143 Linux Networking 0 04-14-2005 01:36 PM
Packet forwarding queries kernel.lover Linux Networking 0 01-30-2005 09:09 AM
Packet forwarding Manu J Linux Networking 5 09-14-2003 10:45 AM
packet forwarding luke Linux Networking 1 09-03-2003 06:11 PM
Packet forwarding Andy Zhang Linux Networking 3 08-02-2003 02:12 PM



1 2 3 4 5 6 7 8 9 10 11