tutorial/tutorial-linear-dumbbell.cc
changeset 2888 872dc8466352
parent 2887 9a637e6daee0
child 2965 4b28e9740e3b
child 2996 a83b94e277d4
equal deleted inserted replaced
2887:9a637e6daee0 2888:872dc8466352
    56   csma.SetChannelParameter ("BitRate", DataRate (10000000));
    56   csma.SetChannelParameter ("BitRate", DataRate (10000000));
    57   csma.SetChannelParameter ("Delay", MilliSeconds (2));
    57   csma.SetChannelParameter ("Delay", MilliSeconds (2));
    58   NetDeviceContainer dev1 = csma.Install (lan1);
    58   NetDeviceContainer dev1 = csma.Install (lan1);
    59   Ipv4AddressHelper ipv4;
    59   Ipv4AddressHelper ipv4;
    60   ipv4.SetBase ("10.1.1.0", "255.255.255.0");
    60   ipv4.SetBase ("10.1.1.0", "255.255.255.0");
    61   Ipv4InterfaceContainer i1 = ipv4.Allocate (dev1);
    61   Ipv4InterfaceContainer i1 = ipv4.Assign (dev1);
    62 
    62 
    63 
    63 
    64 //
    64 //
    65 // Create the lan on the right side of the dumbbell.
    65 // Create the lan on the right side of the dumbbell.
    66 //
    66 //
    68   lan2.Create (4);
    68   lan2.Create (4);
    69   internet.Install (lan2);
    69   internet.Install (lan2);
    70 
    70 
    71   NetDeviceContainer dev2 = csma.Install (lan2);
    71   NetDeviceContainer dev2 = csma.Install (lan2);
    72   ipv4.SetBase ("10.1.2.0", "255.255.255.0");
    72   ipv4.SetBase ("10.1.2.0", "255.255.255.0");
    73   Ipv4InterfaceContainer i2 = ipv4.Allocate (dev2);
    73   Ipv4InterfaceContainer i2 = ipv4.Assign (dev2);
    74 
    74 
    75 
    75 
    76 //
    76 //
    77 // Create the point-to-point link to connect the two lans.
    77 // Create the point-to-point link to connect the two lans.
    78 //
    78 //
    80   PointToPointHelper p2p;
    80   PointToPointHelper p2p;
    81   p2p.SetChannelParameter ("BitRate", DataRate (38400));
    81   p2p.SetChannelParameter ("BitRate", DataRate (38400));
    82   p2p.SetChannelParameter ("Delay", MilliSeconds (20));
    82   p2p.SetChannelParameter ("Delay", MilliSeconds (20));
    83   NetDeviceContainer dev3 = p2p.Install (backbone);
    83   NetDeviceContainer dev3 = p2p.Install (backbone);
    84   ipv4.SetBase ("10.1.3.0", "255.255.255.0");
    84   ipv4.SetBase ("10.1.3.0", "255.255.255.0");
    85   ipv4.Allocate (dev3);
    85   ipv4.Assign (dev3);
    86 
    86 
    87 //
    87 //
    88 // Create data flows across the link:
    88 // Create data flows across the link:
    89 //   n0 ==> n4 ==> n0
    89 //   n0 ==> n4 ==> n0
    90 //   n1 ==> n5 ==> n1
    90 //   n1 ==> n5 ==> n1