ExtUpperIpv4NetworkLayer¶
Package: inet.emulation.networklayer.ipv4
compound module ExtUpperIpv4NetworkLayer
Provides a network layer that connects the simulation to a real network on the host computer using a TUN device. Allows simulated applications to send and receive packets through the host’s networking stack at the IP layer. Contains standard components like routing table and ARP, and uses ExtUpperIpv4 with a TUN device for external connectivity.
Using this network layer in a host or router implies that layers above IPv4 are provided by the host operating system, while layers below IPv4 are simulated.
Usage diagram¶
Inheritance diagram¶
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
interfaceTableModule |
string |
Properties¶
Name |
Value |
Description |
|---|---|---|
display |
i=block/fork |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
ifIn |
input |
||
ifOut |
output |
||
transportIn |
input |
||
transportOut |
output |
Unassigned submodule parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
configurator.displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
configurator.interfaceTableModule |
string |
The path to the InterfaceTable module |
|
configurator.routingTableModule |
string |
||
configurator.networkConfiguratorModule |
string |
“configurator” |
The absolute path to the Ipv4NetworkConfigurator; use “” if there is no configurator |
configurator.configureRoutingTable |
bool |
true |
Add routing entries to the routing table (uses the configurator module) |
routingTable.displayStringTextFormat |
string |
“{routingTableStatusText}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
routingTable.interfaceTableModule |
string |
The path to the InterfaceTable module |
|
routingTable.routerId |
string |
“auto” |
For routers, the router id using IPv4 address dotted |
routingTable.netmaskRoutes |
string |
“*” |
Maintain netmask routes for interfaces |
routingTable.forwarding |
bool |
true |
Turns IP forwarding on/off |
routingTable.multicastForwarding |
bool |
false |
Turns multicast forwarding on/off |
routingTable.useAdminDist |
bool |
false |
Use Cisco-like administrative distances |
routingTable.routingFile |
string |
“” |
Routing table file name |
string |
“TUN device: {device}\nrcv:{numReceived} snt:{numSent}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
|
string |
|||
string |
“” |
||
string |
“Ext” |
||
arp.displayStringTextFormat |
string |
“size:{arpCacheSize} sent:{numRequestsSent}\nrepl:{numRepliesSent} fail:{numFailedResolutions}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
arp.interfaceTableModule |
string |
The path to the InterfaceTable module |
|
arp.routingTableModule |
string |
||
arp.retryTimeout |
double |
1s |
Number of seconds ARP waits between retries to resolve an IPv4 address |
arp.retryCount |
int |
3 |
Number of times ARP will attempt to resolve an IPv4 address |
arp.cacheTimeout |
double |
120s |
Number of seconds unused entries in the cache will time out |
arp.proxyArpInterfaces |
string |
“*” |
List of interfaces that proxy ARP is enabled on (all interfaces by default) |
lp.displayStringTextFormat |
string |
“processed {numProcessedPackets} pk ({processedTotalLength})” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
lp.interfaceTableModule |
string |
Module path to the InterfaceTable module |
|
lp.forwardServiceRegistration |
bool |
true |
|
lp.forwardProtocolRegistration |
bool |
true |
|
lp.interfaceMapping |
object |
{} |
Maps network interface names to connected submodule names (e.g. {“eth0”: “bridging”}), overrides automatically learned dispatching; * overrides all learned network interfaces, ? overrides default |
lp.serviceMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ethernetmac”: “bridging”}), overrides automatically learned dispatching; * overrides all learned services, ? overrides default |
lp.protocolMapping |
object |
{} |
Maps protocols to connected submodule names (e.g. {“ipv4”: “bridging”}), overrides automatically learned dispatching; * overrides all learned protocols, ? overrides default |
Source code¶
//
// Provides a network layer that connects the simulation to a real network on the
// host computer using a TUN device. Allows simulated applications to send and
// receive packets through the host's networking stack at the IP layer. Contains
// standard components like routing table and ARP, and uses ~ExtUpperIpv4 with a
// TUN device for external connectivity.
//
// Using this network layer in a host or router implies that layers above IPv4 are
// provided by the host operating system, while layers below IPv4 are simulated.
//
module ExtUpperIpv4NetworkLayer like INetworkLayer
{
parameters:
string interfaceTableModule;
*.interfaceTableModule = default(absPath(this.interfaceTableModule));
*.routingTableModule = default(absPath(".routingTable"));
@display("i=block/fork");
gates:
input ifIn @labels(INetworkHeader);
output ifOut @labels(INetworkHeader);
input transportIn @labels(Ipv4ControlInfo/down);
output transportOut @labels(Ipv4ControlInfo/up);
submodules:
configurator: Ipv4NodeConfigurator {
parameters:
@display("p=100,100;is=s");
}
routingTable: Ipv4RoutingTable {
parameters:
@display("p=100,200;is=s");
}
ip: <default("ExtUpperIpv4")> like IIpv4 {
parameters:
@display("p=500,100");
}
arp: <default("Arp")> like IArp {
parameters:
@display("p=200,100;q=pendingQueue");
}
lp: MessageDispatcher {
parameters:
@display("p=350,200;b=600,5");
}
connections allowunconnected:
arp.ifOut --> lp.in++;
arp.ifIn <-- lp.out++;
ip.queueOut --> lp.in++;
ip.queueIn <-- lp.out++;
lp.out++ --> { @display("m=s"); } --> ifOut;
lp.in++ <-- { @display("m=s"); } <-- ifIn;
}
File: src/inet/emulation/networklayer/ipv4/ExtUpperIpv4NetworkLayer.ned