Вот пример конфигурации сети для финансовой компании в OMNeT++ 6.1 с INET 4.5:
FinancialCompanyNetwork.ned:
package financialcompany;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.node.inet.StandardHost;
import inet.node.inet.Router;
import inet.node.ethernet.EthernetSwitch;
import inet.node.internetcloud.InternetCloud;
network FinancialCompanyNetwork
{
parameters:
int numBranches = 3;
int numOfficesPerBranch = 2;
int numWorkstationsPerOffice = 4-5;
submodules:
configurator: Ipv4NetworkConfigurator {
@display("p=100,50");
}
internetCloud: InternetCloud {
@display("p=500,100;is=vl");
}
mainRouter: Router {
@display("p=500,250");
}
localServer: StandardHost {
@display("p=650,250;i=device/server");
}
branch[numBranches]: BranchSubnet {
@display("p=200,400,row,200");
}
connections:
// Подключение филиалов к главному роутеру через интернет
for i=0..numBranches-1 {
branch[i].gatewayRouter.pppg++ <--> InternetLink <--> internetCloud.pppg++;
}
// Подключение главного офиса
mainRouter.pppg++ <--> InternetLink <--> internetCloud.pppg++;
// Локальный сервер к главному роутеру
localServer.ethg++ <--> Eth1G <--> mainRouter.ethg++;
}
module BranchSubnet
{
parameters:
int numOffices = 2;
gates:
inout gatewayRouter;
submodules:
gatewayRouter: Router {
@display("p=150,100");
}
branchSwitch: EthernetSwitch {
@display("p=150,200");
}
office[numOffices]: OfficeSubnet {
@display("p=50,300,row,200");
}
connections:
gatewayRouter.ethg++ <--> Eth1G <--> branchSwitch.ethg++;
for i=0..numOffices-1 {
office[i].officeSwitch.ethg++ <--> Eth1G <--> branchSwitch.ethg++;
}
}
module OfficeSubnet
{
parameters:
int numWorkstations = default(4);
submodules:
officeSwitch: EthernetSwitch {
@display("p=100,50");
}
workstation[numWorkstations]: StandardHost {
@display("p=50,150,row,50;i=device/pc");
}
connections:
for i=0..numWorkstations-1 {
workstation[i].ethg++ <--> Eth100M <--> officeSwitch.ethg++;
}
}
channel InternetLink extends ned.DatarateChannel
{
datarate = 30Mbps;
delay = 10ms;
ber = 1e-9;
}
channel Eth1G extends ned.DatarateChannel
{
datarate = 1Gbps;
delay = 0.1us;
}
channel Eth100M extends ned.DatarateChannel
{
datarate = 100Mbps;
delay = 0.1us;
}
omnetpp.ini:
[General]
network = FinancialCompanyNetwork
sim-time-limit = 100s
# Конфигурация IP-адресов
*.configurator.config = xmldoc("network_config.xml")
# Настройки для рабочих станций
**.workstation[*].numApps = 2
**.workstation[*].app[0].typename = "TcpSessionApp"
**.workstation[*].app[0].localPort = -1
**.workstation[*].app[0].connectAddress = "localServer"
**.workstation[*].app[0].connectPort = 80
**.workstation[*].app[0].sendBytes = 1MiB
**.workstation[*].app[0].startTime = uniform(1s, 5s)
**.workstation[*].app[1].typename = "PingApp"
**.workstation[*].app[1].destAddr = "localServer"
**.workstation[*].app[1].startTime = uniform(0s, 1s)
# Настройки локального сервера
**.localServer.numApps = 2
**.localServer.app[0].typename = "TcpEchoApp"
**.localServer.app[0].localPort = 80
**.localServer.app[1].typename = "TcpEchoApp"
**.localServer.app[1].localPort = 443
# Настройки TCP
**.tcp.typename = "Tcp"
**.tcp.mss = 1460B
# Визуализация
*.visualizer.*.interfaceTableVisualizer.displayInterfaceTables = true
*.visualizer.*.routingTableVisualizer.displayRoutingTables = true
network_config.xml:
<config>
<interface hosts="**" address="10.x.x.x" netmask="255.255.255.0"/>
<!-- Главный офис -->
<interface hosts="mainRouter" towards="internetCloud" address="203.0.113.1" netmask="255.255.255.252"/>
<interface hosts="localServer" address="192.168.0.10" netmask="255.255.255.0"/>
<!-- Филиал 1 -->
<interface hosts="branch[0].gatewayRouter" towards="internetCloud" address="203.0.113.5" netmask="255.255.255.252"/>
<interface hosts="branch[0].office[*].workstation[*]" address="192.168.1.x" netmask="255.255.255.0"/>
<!-- Филиал 2 -->
<interface hosts="branch[1].gatewayRouter" towards="internetCloud" address="203.0.113.9" netmask="255.255.255.252"/>
<interface hosts="branch[1].office[*].workstation[*]" address="192.168.2.x" netmask="255.255.255.0"/>
<!-- Филиал 3 -->
<interface hosts="branch[2].gatewayRouter" towards="internetCloud" address="203.0.113.13" netmask="255.255.255.252"/>
<interface hosts="branch[2].office[*].workstation[*]" address="192.168.3.x" netmask="255.255.255.0"/>
<route hosts="**" destination="*" netmask="*" interface="eth0" gateway="*"/>
</config>
Эта конфигурация создает сеть с 3 филиалами, каждый филиал имеет 2 офиса, в каждом офисе 4-5 рабочих мест (всего получается около 27 рабочих мест). Все филиалы подключены через интернет-облако с ограничением скорости 30 Мбит/с. Локальный сервер находится в главном офисе.
Для запуска симуляции используйте команду:
opp_run -l INET -n .:../inet4.5/src -u Cmdenv omnetpp.ini