The interface for creating and configuring a LAN slightly differs from those of point-to-point link. At the top level, the OTcl class Simulator exports a new method called make-lan. The parameters to this method are similar to the method duplex-link, except that make-lan only accepts a list of nodes as a single parameter instead of 2 parameters as in duplex-link:
Simulator instproc make-lan {nodes bw delay lltype ifqtype mactype chantype}
The optional parameters to make-lan specify the type of objects to be created for the link layer (LL), the interface queue, the MAC layer (Mac), and the physical layer (Channel). Below is an example of how a new CSMA/CD (Ethernet) LAN is created.
Example:
$ns make-lan "$n1 $n2" $bw $delay LL Queue/DropTail Mac/Csma/Cdcreates a LAN with basic link-layer, drop-tail queue, and CSMA/CD MAC.