OMNet++でネットワークシミュレーションを構築しようとしています。問題は、EtherSwitchおよびEtherHostデバイスを構成してIPを与える方法がわからないことです。スイッチとルーター間のトラフィックをルーティングするために必要なルーティングコードは何ですか。ルーターのポートのIPアドレスは、次の表のようにする必要があります。
ルータレッグIP1
------ 1 --- 192.168.1.0/24
1 ------ 4 --- 192.168.4.1
1 ------ 5 --- 192.168.5.1
2 --- ---- 2 --- 192.168.2.0/24
2 ------ 5 --- 192.168.5.2
2 ------ 6 --- 192.168.6.2
3 ------ 3-
--192.168.3.0 / 24 3 ------ 4 --- 192.168.4.3 3
------ 6 --- 192.168.6.3
必要なネットワークの画像は次のとおりです。
私のNEDファイル:
import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import ned.DatarateChannel;
import inet.nodes.ethernet.EtherSwitch;
import inet.nodes.ethernet.EtherHost;
import inet.networklayer.autorouting.FlatNetworkConfigurator;
network gyte
{
@display("bgb=457,318");
types:
channel geth extends DatarateChannel
{
datarate = 1Gbps;
}
channel hgeth extends DatarateChannel
{
datarate = 512Mbps;
}
submodules:
// Routers
routers[3]: Router {
parameters:
@display("p=208,272,row=id;i=abstract/router");
gates:
pppg[3];
}
// Switches
switches[3]: EtherSwitch {
parameters:
@display("p=179,162,row");
gates:
ethg[3];
}
// Hosts
ehosts[4]: EtherHost {
parameters:
@display("p=384,56,row");
gates:
ethg;
}
// Servers
eservers[2]: EtherHost {
parameters:
@display("i=device/server;p=117,71,row");
gates:
ethg;
}
configurator: FlatNetworkConfigurator {
@display("p=22,25");
}
connections:
ehosts[0].ethg <--> switchs[0].ethg[0];
eservers[0].ethg <--> switchs[0].ethg[1];
ehosts[1].ethg <--> switchs[1].ethg[0];
eservers[1].ethg <--> switchs[1].ethg[1];
switchs[0].ethg[2] <--> routers[0].pppg[0];
switchs[1].ethg[2] <--> routers[1].pppg[0];
routers[0].pppg[1] <--> routers[1].pppg[1];
routers[0].pppg[2] <--> routers[2].pppg[0];
routers[1].pppg[2] <--> routers[2].pppg[1];
routers[2].pppg[2] <--> switchs[2].ethg[0];
switchs[2].ethg[1] <--> ehosts[2].ethg;
switchs[2].ethg[2] <--> ehosts[3].ethg;
}