如何正确设置OMNET++/INET的STP功能?

问题描述 投票:0回答:1

我已经建立了一个循环拓扑,如下图所示: 我已配置生成树协议 (STP) 功能来中断环路,从而防止广播风暴。以下是我的网络描述 (NED) 文件和初始化 (INI) 文件:

network testNet

    configurator: Ipv4NetworkConfigurator {
        parameters:
            @display("p=42,340;is=s");
    }

    switch1: EthernetSwitch {
        parameters:
            @display("p=221,149");
        gates:
            ethg[6];
    }
    switch2: EthernetSwitch {
        parameters:
            @display("p=290,240");
        gates:
            ethg[6];
    }
    switch3: EthernetSwitch {
        parameters:
            @display("p=385,149");
        gates:
            ethg[6];
    }
    switch4: EthernetSwitch {
        parameters:
            @display("p=303,42");
        gates:
            ethg[3];
    }
    // 创建9个终端节点
    host1: StandardHost {
        @display("p=99,72");
    }
    host2: StandardHost {
        @display("p=99,150");
    }
    host3: StandardHost {
        @display("p=99,259");
    }
    host4: StandardHost {
        @display("p=221,371");
    }
    host5: StandardHost {
        @display("p=364,371");
    }
    host6: StandardHost {
        @display("p=290,371");
    }
    host7: StandardHost {
        @display("p=520,61");
    }
    host8: StandardHost {
        @display("p=520,143");
    }
    host9: StandardHost {
        @display("p=520,259");
    }
connections allowunconnected:
    switch1.ethg[0] <--> Eth1G {  length = 100m; } <--> switch2.ethg[0];
    switch2.ethg[1] <--> Eth1G {  length = 100m; } <--> switch3.ethg[1];
    switch3.ethg[0] <--> Eth1G {  length = 100m; } <--> switch4.ethg[0];
    switch4.ethg[1] <--> Eth1G {  length = 100m; } <--> switch1.ethg[1];
    switch3.ethg[2] <--> Eth1G {  length = 100m; } <--> switch1.ethg[2];
    switch2.ethg[2] <--> Eth1G {  length = 100m; } <--> switch4.ethg[2];
    switch1.ethg[3] <--> Eth1G {  length = 100m; } <--> host1.ethg++;
    switch1.ethg[4] <--> Eth1G {  length = 100m; } <--> host2.ethg++;
    switch1.ethg[5] <--> Eth1G {  length = 100m; } <--> host3.ethg++;
    switch2.ethg[3] <--> Eth1G {  length = 100m; } <--> host4.ethg++;
    switch2.ethg[4] <--> Eth1G {  length = 100m; } <--> host5.ethg++;
    switch2.ethg[5] <--> Eth1G {  length = 100m; } <--> host6.ethg++;
    switch3.ethg[3] <--> Eth1G {  length = 100m; } <--> host7.ethg++;
    switch3.ethg[4] <--> Eth1G {  length = 100m; } <--> host8.ethg++;
    switch3.ethg[5] <--> Eth1G {  length = 100m; } <--> host9.ethg++;
}

以下是INI文件: Host1 将向 host2 发送 UDP。

    [General]
network = testNet
sim-time-limit = 400s
**.host*.numUdpApps = 1 
*.host1.numApps = 1
*.host1.app[0].typename = "UdpSourceApp"
*.host1.app[0].io.destAddress = "host2"
*.host1.app[0].io.localPort = 1000
*.host1.app[0].io.destPort = 1000
*.host1.app[0].source.packetLength = 1000B
*.host1.app[0].source.productionInterval = 100ms
*.host2.numApps = 1
*.host2.app[0].typename = "UdpSinkApp"
*.host2.app[0].io.localPort = 1000
**.switch*.hasStp = true
**.spanningTreeProtocol = "Stp"
**.switch*.eth[*].typename = "LayeredEthernetInterface"
**.switch*.ethernet.typename = "EthernetLayer"
**.switch*.eth[*].bitrate = 1Gbps
**.switch*.bridging.typename = "MacRelayUnit"
**.switch1.**.address="AAAAAA000001"
**.switch2.**.address="AAAAAA000002"
**.switch3.**.address="AAAAAA000003"
**.switch4.**.address="AAAAAA000004"

尽管进行了这些设置,广播事件仍然存在,如下所示。难道是我的配置有问题?我将非常感谢有关此事的任何指导。

omnet++ inet
1个回答
0
投票

STP 需要一些时间来识别拓扑并将某些接口标记为禁用。默认情况下,第一个 PBDU 帧在 t=1.0 s 时发送,并且在 t=2.0 s 时可以发送 BPDU-TCN 帧。
因此,在您的模拟中,我建议几秒钟后激活流量,例如通过在

omnetpp.ini
:

中进行设置
*.host1.app[0].source.initialProductionOffset = 5s
© www.soinside.com 2019 - 2024. All rights reserved.