(五岁以下儿童)NS3样本演示:桥模块演示样品csma-bridge.cc凝视程序

时间:2022-02-14 17:47:12

(五岁以下儿童)NS3:桥模块演示样品csma-bridge.cc凝视程序


1、Ns3 bridge模csma-bridge.cc演示示例程序的目光

// Network topology
//
// n0 n1
// | |
// ----------
// | Switch |
// ----------
// | |
// n2 n3
//
//
// - CBR/UDP flows from n0 to n1 and from n3 to n0 恒定的比特流从n0转发到n1。从n3转发到n0
// - DropTail queues 队尾丢弃队列
// - Tracing of queues and packet receptions to file "csma-bridge.tr" 追踪队列和包的接收 //该程序为网桥节点安装了四个NetDevice,分别与n0,n1,n2,n4相连,即属于同一个局域网。 通过网桥节点,终于实现了在二层链路层的数据交换
#include <iostream>
#include <fstream> #include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/bridge-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h" using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CsmaBridgeExample"); int
main (int argc, char *argv[])
{
//
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
//我们能够通过选择执行模块,进行方便的调试
#if 0
LogComponentEnable ("CsmaBridgeExample", LOG_LEVEL_INFO);
#endif //
// Allow the user to override any of the defaults and the above Bind() at
// run-time, via command-line arguments
//同意用户执行时,通过命令行參数覆盖属性默认值
CommandLine cmd;
cmd.Parse (argc, argv); //
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");//自己定义logging输出语句,程序执行到此时会输出此语句
NodeContainer terminals;
terminals.Create (4); //创建4个终端 NodeContainer csmaSwitch;
csmaSwitch.Create (1); //创建一个网桥 NS_LOG_INFO ("Build Topology");//自己定义logging输出语句
CsmaHelper csma;//CsmaHelper类,帮助设置设备和信道属性。
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));//每条与网桥连接链路属性设置,数据率有Channel属性指定,而非Device属性指定。
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); // Create the csma links, from each terminal to the switch
//创建每一个终端到网桥的链路
NetDeviceContainer terminalDevices;//终端设备
NetDeviceContainer switchDevices; //网桥设备 for (int i = 0; i < 4; i++)
{
NetDeviceContainer link = csma.Install (NodeContainer (terminals.Get (i), csmaSwitch)); //有两个节点的容器,为它们安装csma设备和信道。它们属于一个局域网
terminalDevices.Add (link.Get (0));//将相应设备加入到终端设备,设备的编号是按这个安装先后顺序编号。
switchDevices.Add (link.Get (1));//加入到网桥
} // Create the bridge netdevice, which will do the packet switching
Ptr<Node> switchNode = csmaSwitch.Get (0);//获取网桥节点
BridgeHelper bridge;
bridge.Install (switchNode, switchDevices);//安装网桥到网桥节点 // Add internet stack to the terminals
InternetStackHelper internet;
internet.Install (terminals); // We've got the "hardware" in place. Now we need to add IP addresses.
//
NS_LOG_INFO ("Assign IP Addresses.");//自己定义logging输出语句
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
ipv4.Assign (terminalDevices);//仅仅有终端设备须要配置ip地址 //
// Create an OnOff application to send UDP datagrams from node zero to node 1.
//建立了一个onoff应用。
NS_LOG_INFO ("Create Applications.");//自己定义logging输出语句
uint16_t port = 9; // Discard port (RFC 863) 丢弃端口??? OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));//Address具有多态性。Create an address from another address. ? ??
onoff.SetConstantRate (DataRate ("500kb/s")); //CBR 恒定速率的比特流从n0转发到n1,从n3转发到n0 ApplicationContainer app = onoff.Install (terminals.Get (0));//OnOffApplication
// Start the application
app.Start (Seconds (1.0));
app.Stop (Seconds (10.0)); // Create an optional packet sink to receive these packets,创建一个节点可选的包接收,主要用于多播情形,支持对仅仅感兴趣的二层多播帧接收。
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port))); app = sink.Install (terminals.Get (1));//安装PacketSink (Applications)到n1
app.Start (Seconds (0.0)); //
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
//
onoff.SetAttribute ("Remote",
AddressValue (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
app = onoff.Install (terminals.Get (3));
app.Start (Seconds (1.1));
app.Stop (Seconds (10.0)); app = sink.Install (terminals.Get (0));//安装PacketSink (Applications)到n0
app.Start (Seconds (0.0)); NS_LOG_INFO ("Configure Tracing.");//自己定义logging输出语句 //
// Configure tracing of all enqueue, dequeue, and NetDevice receive events.配置文件来跟踪入队,出队和NetDevice的接收事件
// Trace output will be sent to the file "csma-bridge.tr"
//
AsciiTraceHelper ascii;//以ASCII格式的tracing追踪信息输出
csma.EnableAsciiAll (ascii.CreateFileStream ("csma-bridge.tr")); //
// Also configure some tcpdump traces; each interface will be traced.配置tcpdump, 跟踪每一个接口
// The output files will be named:
// csma-bridge-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
csma.EnablePcapAll ("csma-bridge", false); //
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");//自己定义logging输出语句
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}

2、解读输出的ASCII Tracing文件:cama-bridge.tr

+:设备队列入队操作,-:设备队列的出队操作,r:网络设备接收到数据包。

//网桥操作,主要涉及ARP逆向地址解析协议
//节点n0開始广播请求ipv4: 10.1.1.2的mac地址
+ 1.00919 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.00919 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
//网桥设备在某个port收到n0的广播帧后。通过其它port在其它局域网内广播,接收port即n4节点的1NetDevice不再广播,仅仅是接收了广播帧
+ 1.01129 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.01129 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
+ 1.01129 /NodeList/4/DeviceList/2/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.01129 /NodeList/4/DeviceList/2/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
+ 1.01129 /NodeList/4/DeviceList/3/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.01129 /NodeList/4/DeviceList/3/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
r 1.01129 /NodeList/4/DeviceList/0/$ns3::CsmaNetDevice/MacRx
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
//目的节点n1收到了发给它的广播帧
r 1.0134 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
//n1回复n0,不仅有IP 地址,还知道了mac地址。逆向地址学习
+ 1.0134 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:03, destination=00:00:00:00:00:01)
ns3::ArpHeader (reply source mac: 00-06-00:00:00:00:00:03 source ipv4: 10.1.1.2 dest mac: 00-06-00:00:00:00:00:01 dest ipv4: 10.1.1.1)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.0134 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:03, destination=00:00:00:00:00:01) ns3::ArpHeader (reply source mac: 00-06-00:00:00:00:00:03 source ipv4: 10.1.1.2 dest mac: 00-06-00:00:00:00:00:01 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
//n2接收到n1原始广播帧
r 1.0134 /NodeList/2/DeviceList/0/$ns3::CsmaNetDevice/MacRx
ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2)
Payload (size=18) ns3::EthernetTrailer (fcs=0)
//n3接收到n1原始广播帧
r 1.0134 /NodeList/3/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1 dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0) //由于n1的回复帧有目的mac地址,网桥知道仅仅需在0port转发到n0所在局域网
+ 1.0155 /NodeList/4/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:03, destination=00:00:00:00:00:01) ns3::ArpHeader (reply source mac: 00-06-00:00:00:00:00:03 source ipv4: 10.1.1.2 dest mac: 00-06-00:00:00:00:00:01 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.0155 /NodeList/4/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:03, destination=00:00:00:00:00:01) ns3::ArpHeader (reply source mac: 00-06-00:00:00:00:00:03 source ipv4: 10.1.1.2 dest mac: 00-06-00:00:00:00:00:01 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0) //n0接收n1节点的回复帧
r 1.0176 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:03, destination=00:00:00:00:00:01) ns3::ArpHeader (reply source mac: 00-06-00:00:00:00:00:03 source ipv4: 10.1.1.2 dest mac: 00-06-00:00:00:00:00:01 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0) //n0继续给n1发送数据,发了两个数据包
+ 1.0176 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2)
ns3::UdpHeader (length: 520 49153 > 9)
Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.0176 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
+ 1.0176 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 1 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.01852 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 1 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //网桥依据mac地址直接将第一个数据包由port1转发到n1所在局域网
+ 1.0205 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2)
ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.0205 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //n1节点接收第一个数据包
r 1.02339 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2)
ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //网桥依据mac地址直接将第二个数据包由port1转发到n1所在局域网
+ 1.02347 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 1 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2)
ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.02347 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 1 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //n0发送第三个数据包
+ 1.02458 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 2 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.02458 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 2 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //n1接收第2个数据包
r 1.02636 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx
ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 1 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)/ //网桥转发第3个数据包
+ 1.02747 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 2 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.02747 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 2 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //n1接收第3个数据包
r 1.03036 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 2 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) //发送接收转发第4个数据包
+ 1.03277 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 3 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.03277 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 3 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
+ 1.03566 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 3 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.03566 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 3 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
r 1.03855 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 3 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
//发送接收转发第5个数据包
+ 1.04096 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 4 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.04096 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 4 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
+ 1.04385 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 4 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.04385 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 4 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
r 1.04675 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 4 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) ...... + 1.1065 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03)
ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 12 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.1065 /NodeList/0/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 12 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
+ 1.10939 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 12 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
- 1.10939 /NodeList/4/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 12 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0) 第二部分,节点n3到n0的发送过程開始,内容相似(n0到n1同一时候在通信)
+ 1.11119 /NodeList/3/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:07, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:07 source ipv4: 10.1.1.4 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.11119 /NodeList/3/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:07, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:07 source ipv4: 10.1.1.4 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
r 1.11228 /NodeList/1/DeviceList/0/$ns3::CsmaNetDevice/MacRx ns3::EthernetHeader ( length/type=0x800, source=00:00:00:00:00:01, destination=00:00:00:00:00:03) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 12 protocol 17 offset (bytes) 0 flags [none] length: 540 10.1.1.1 > 10.1.1.2) ns3::UdpHeader (length: 520 49153 > 9) Payload (size=512) ns3::EthernetTrailer (fcs=0)
+ 1.11329 /NodeList/4/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:07, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:07 source ipv4: 10.1.1.4 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 1.11329 /NodeList/4/DeviceList/0/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader ( length/type=0x806, source=00:00:00:00:00:07, destination=ff:ff:ff:ff:ff:ff) ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:07 source ipv4: 10.1.1.4 dest ipv4: 10.1.1.1) Payload (size=18) ns3::EthernetTrailer (fcs=0)
......

版权声明:本文博主原创文章。博客,未经同意不得转载。