i need to send data from ns-3 to the outside world...
i started by creating a topology with two nodes, connected through a
csma connection. this nodes have address 10.0.0.1 and 10.0.0.2 with a
/24 netmask.
on the second node i installed a second netdevice with address 10.0.1.1/24
using the udpsocket example i installed a src socket on the first node
on 10.0.0.1/24 and dst socket on the second node on 10.0.1.1/24.
the program works as expected, and messages are exchanges smoothly :)
here is the code http://pastebin.com/3R1jgNRx
second step has been to create a tap interface and attach it
10.0.1.1/24. on the real machine i have a real nic with ip address
10.0.1.2/24.
i changed the destination address of the SendStuff ro 10.0.1.2,
launched a server listening on the same address and same port but
nothing is received...
here is the code http://pastebin.com/qVCAPUXS
any hint on how to solve this?
thanks
luca
--
Chiave pubblica http://luca.costantino.googlepages.com/luca.costantino.asc
Prima di tutto vennero a prendere gli zingari e fui contento, perché
rubacchiavano.
Poi vennero a prendere gli ebrei e stetti zitto, perché mi stavano antipatici.
Poi vennero a prendere gli omosessuali, e fui sollevato, perché mi
erano fastidiosi.
Poi vennero a prendere i comunisti, e io non dissi niente, perché non
ero comunista.
Un giorno vennero a prendere me, e non c’era rimasto nessuno a protestare.
(Martin Niemöller)
Have you tried instead the EmuNetDevice instead of the TapBridge? It
sounds like you want the functionality of emu (src/emu).
- Tom
hi and thanks for your reply... i wasn't sure about what to use,
tapbridge or emunet... i'm gonna do some test with emunet, then.
thanks again
There is also 3 exemples using DCE and TapBridge and CCNx.
Did you set the good rights to the executable named tap-creator ?
Frederic.
so... i started using src/examples/emu-ping.cc modifying it to ping
8.8.8.8 (google dns) and it worked like a charm.
next step has been to put a socket a sending function in the source
instead of the v4ping application.
here's the code http://pastebin.com/kDducyS9
unfortunately my code is not working ;( i'm not even able to see any
packet coming from 192.168.27.90 with wireshark...
what am i doing wrong?
luca
I don't think I got what you're trying to say... It seem to me that
EmuNetDevice is the right component to use if I want to communicate
from ns-3 to the real world (instead of tap taht is use to communicate
from the real world to ns-3)...
thanks for having pointed that out! i think that the documentation
section should be revisited!
did you have a look at the not working code that i posted yesterday
with tad device?
i *really* need some help in this
thanks
Frederic.
i think i found the problem
it seems that i cannot send udp packet to a server hosted on the same
machine i'm running ns-3
here's the code http://pastebin.com/vSuhxgdi
i made a test using both a ping application a send-through-udp-socket
application, and i watched the output of ns-3, of the real server
application and of wireshark
test 1: remoteIP 192.168.27.95, i.e. a working node on my subnet.
ping worked fine, and through wireshark i was able to see that 2 kind
of packets were sent, ICMP packets (from the ping application) and udp
packet (from my application).
of course those last packets went lost because there were no server
application on that machine.
test 2: remoteIp 192.168.27.117, i.e. a workin node on my subnet with
my server application running.
everything works fine, ping are received and udp data are correctly
received by my application --> yeah!
test 3: remoteIp 192.168.27.76, i.e. my pc eth0's real address, where
the same server application as before is running
ping doesn't works and but server receives no data.
is that a bug?
In particular i can see arp messages sent from 00:00:00:00:00:01 (i.e.
the emunetdevice node) asking for 192.68.27.76's mac address... but no
one responds...
No, case 3 is not supported. eth0 will not see the arps.
If you had a spare physical device such as an eth1, you could use that
in emu mode and add it to the bridge along with eth0.
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
If not, if you want to send to your own machine's eth0, you might be
able to create a tap device, do not assign it an address, and add it to
a Linux bridge with eth0; e.g.
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 tap0
and then use the TapBridge in 'UseLocal' mode in ns-3. On the ns-3
side, you would want to bridge the ns-3 net device (CSMA) to another
CSMA device so that it could talk to an ns-3 IP layer. Kind of
convoluted and untested, but might work.
But it would be simpler to just talk to your local server via another
subnet that you put on the tap device in the usual fashion. In general,
it is easier to use TapBridge to talk to your localhost and namespaces,
and Emu to talk to other hosts.
- Tom
thanks for your reply
i finally succeeded in what i need...
client app --> client/server app --> ns3 --> server app, everythin
running on the same machine
i.e. i have a certain number of client apps that sends data to a gw
application that forwards data with a certain policy to ns3, wich in
turn manipulate data ad forwards it to a server application that
collects everything
i used two tap interfaces in ns3, one for the incoming connection, and
one for the outgoing
thanks again for your help
Frederic.