Skip to content
Browse files

dhcp: added examples

  • Loading branch information...
1 parent 571cc1d commit cdce1b75ba9bc4e5fc61fac2182265346dc48679 @ZoltanBojthe ZoltanBojthe committed Jun 27, 2012
View
14 .oppfeatures
@@ -244,6 +244,20 @@
linkerFlags = ""
/>
<feature
+ id="DHCP_examples"
+ name="DHCP examples (Ethernet)"
+ description = "examples for DHCP protocol"
+ initiallyEnabled = "true"
+ requires = "DHCP Ethernet mobility radio Ieee80211"
+ labels = "protocols dhcp"
+ nedPackages = "
+ inet.examples.dhcp
+ "
+ extraSourceFolders = ""
+ compileFlags = ""
+ linkerFlags = ""
+ />
+ <feature
id="Ethernet"
name="Ethernet"
description = "IEEE 802.3 models (MAC, LLC, Encap) with support for classic
View
56 examples/dhcp/eth/WiredNetWithDHCP.ned
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2012 OpenSim Ltd
+// @author: Zoltan Bojthe
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+
+package inet.examples.dhcp.eth;
+
+import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
+import inet.nodes.ethernet.EtherSwitch;
+import inet.nodes.inet.StandardHost;
+import inet.util.ThruputMeteringChannel;
+
+
+network WiredNetWithDHCP
+{
+ parameters:
+ int numHosts;
+ types:
+ channel ethernetline extends ThruputMeteringChannel
+ {
+ delay = 0.1us;
+ datarate = 10Mbps;
+ thruputDisplayFormat = "u";
+ }
+ submodules:
+ srv: StandardHost;
+ switch: EtherSwitch {
+ parameters:
+ @display("p=186,250");
+ }
+ cli[numHosts]: StandardHost;
+ configurator: IPv4NetworkConfigurator {
+ parameters:
+ config = xml("<config><interface hosts='srv' address='192.168.1.1' netmask='255.255.255.0' /></config>");
+ }
+ connections:
+ srv.ethg++ <--> ethernetline <--> switch.ethg++;
+ for i=0..numHosts-1 {
+ cli[i].ethg++ <--> ethernetline <--> switch.ethg++;
+ }
+}
+
View
24 examples/dhcp/eth/omnetpp.ini
@@ -0,0 +1,24 @@
+[General]
+tkenv-plugin-path = ../../../etc/plugins
+sim-time-limit = 100d
+
+network = WiredNetWithDHCP
+
+
+*.numHosts = 10
+
+**.numUdpApps = 1
+
+
+**.cli[*].udpApp[0].typename = "DHCPClient"
+**.cli[*].udpApp[0].interface="eth0" # interface to be configured
+
+**.srv.udpApp[0].typename = "DHCPServer"
+**.srv.udpApp[0].net = "192.168.1.0" # IP network to assign
+**.srv.udpApp[0].mask = "255.255.255.0" # netmask to assign
+**.srv.udpApp[0].ipBegin = "192.168.1.100" # ip to start to lease
+**.srv.udpApp[0].clientNum = 100 # number of ip to lease
+**.srv.udpApp[0].gateway = "192.168.1.1" # gateway to assign
+**.srv.udpApp[0].dns = "" # dns to assign
+**.srv.udpApp[0].leaseTime = 1000s # lease time in seconds
+**.srv.udpApp[0].interface="eth0" # interface to listen
View
64 examples/dhcp/wlan/WirelessNetWithDHCP.ned
@@ -0,0 +1,64 @@
+//
+// Copyright (C) 2010 Juan-Carlos Maureira
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see http://www.gnu.org/licenses/.
+//
+
+package inet.examples.dhcp.wlan;
+import inet.nodes.ethernet.Eth100M;
+import inet.nodes.inet.Router;
+import inet.nodes.inet.StandardHost;
+import inet.nodes.inet.WirelessHost;
+import inet.world.radio.ChannelControl;
+
+
+//
+// TODO auto-generated module
+//
+network WirelessNetWithDHCP
+{
+ @display("bgb=590,407;bgl=2");
+ int numWirelessHosts;
+ submodules:
+ channelControl: ChannelControl {
+ @display("p=64,34");
+ pMax = 100mW;
+ numChannels = 5;
+ }
+ router: Router {
+ @display("p=241,136");
+ routingFile = "router.rt";
+ }
+ standardHost: StandardHost {
+ @display("p=418,134");
+ routingFile = "host.rt";
+ }
+ wirelessHost[numWirelessHosts]: WirelessHost {
+ //@display("p=135,333");
+ numUdpApps = 1;
+ udpApp[0].typename = "DHCPClient";
+ }
+
+ wirelessRouter: WirelessHost {
+ @display("p=154,207");
+ routingFile = "wirelessRouter.rt";
+ numUdpApps = 1;
+ udpApp[0].typename = "DHCPServer";
+ wlan[0].mgmtType = default("Ieee80211MgmtAP");
+ wlan[0].mgmt.encapDecap = "true";
+ }
+ connections:
+ standardHost.ethg++ <--> Eth100M <--> router.ethg++;
+ wirelessRouter.ethg++ <--> Eth100M <--> router.ethg++;
+}
View
8 examples/dhcp/wlan/host.rt
@@ -0,0 +1,8 @@
+ifconfig:
+name: eth0 inet_addr: 10.0.1.1 MTU: 1500 Metric: 1
+ifconfigend.
+
+route:
+10.1.1.1 * 255.255.255.255 H 0 eth0
+default: 10.1.1.1 0.0.0.0 G 0 eth0
+routeend.
View
91 examples/dhcp/wlan/omnetpp.ini
@@ -0,0 +1,91 @@
+[General]
+tkenv-plugin-path = ../../../etc/plugins
+sim-time-limit = 100d
+
+network = WirelessNetWithDHCP
+
+repeat = 1
+
+**.numWirelessHosts = 10
+
+# Avoid to record the mac states
+**.wlan.mac.State.vector-recording = false
+**.wlan.mac.RadioState.vector-recording = false
+
+#playground options
+
+**.constraintAreaMinX = 0m
+**.constraintAreaMinY = 0m
+**.constraintAreaMinZ = 0m
+**.constraintAreaMaxX = 500m
+**.constraintAreaMaxY = 500m
+**.constraintAreaMaxZ = 0m
+
+# access point
+**.mgmt.frameCapacity = 10
+
+# mobility settings
+
+
+# studied wirelessHost ping app
+**.wirelessHost[0].pingApp.destAddr="192.168.0.10"
+**.wirelessHost[0].pingApp.srcAddr=""
+**.wirelessHost[0].pingApp.packetSize=56B
+**.wirelessHost[0].pingApp.sendInterval=0.1s
+
+
+**.wirelessHost[0].pingApp.hopLimit=32
+**.wirelessHost[0].pingApp.count=0
+**.wirelessHost[0].pingApp.startTime = uniform(10s,20s)
+**.wirelessHost[0].pingApp.printPing=true
+
+# backgroundtraffic ping app
+
+**.wirelessHost[*].pingApp.destAddr="10.0.1.1"
+**.wirelessHost[*].pingApp.srcAddr=""
+**.wirelessHost[*].pingApp.packetSize=56B
+**.wirelessHost[*].pingApp.sendInterval=0.05s
+**.wirelessHost[*].pingApp.hopLimit=32
+**.wirelessHost[*].pingApp.count=0
+**.wirelessHost[*].pingApp.startTime = uniform(10s,20s)
+**.wirelessHost[*].pingApp.printPing=true
+
+
+# Wireless Router DHCP Server
+
+**.udpApp[0].net = "192.168.0.0"
+**.udpApp[0].mask = "255.255.255.0"
+**.udpApp[0].ipBegin = "192.168.0.10"
+**.udpApp[0].clientNum = 100
+**.udpApp[0].gateway = "192.168.0.1"
+**.udpApp[0].dns = "192.168.0.0"
+**.udpApp[0].interface = "wlan0"
+**.udpApp[0].leaseTime = 900s
+
+# wireless configuration
+**.wirelessRouter.wlan[0].mgmtType = "Ieee80211MgmtAP"
+**.wlan[0].agent.activeScan = true
+**.wlan[0].agent.channelsToScan = "" # "" means all
+**.wlan[0].agent.probeDelay = 0.1s
+**.wlan[0].agent.minChannelTime = 0.15s
+**.wlan[0].agent.maxChannelTime = 0.3s
+**.wlan[0].agent.authenticationTimeout = 5s
+**.wlan[0].agent.associationTimeout = 5s
+**.wlan[0].agent.startingTime = uniform(0s,2s)
+
+
+**.mac.address = "auto"
+**.mac.maxQueueSize = 14
+**.mac.rtsThresholdBytes = 4000B
+**.mac.bitrate = 11Mbps
+**.wlan.mac.retryLimit = 7
+**.wlan.mac.cwMinData = 7
+**.wlan.mac.cwMinBroadcast = 31
+
+**.radio.bitrate = 11Mbps
+**.radio.transmitterPower = 100.0mW
+**.radio.thermalNoise = -110dBm
+**.radio.sensitivity = -85dBm
+**.radio.pathLossAlpha = 2
+**.radio.snirThreshold = 4dB
+
View
2 examples/dhcp/wlan/package.ned
@@ -0,0 +1,2 @@
+@license(LGPL);
+package inet.examples.dhcp.wlan;
View
9 examples/dhcp/wlan/router.rt
@@ -0,0 +1,9 @@
+ifconfig:
+name: eth1 inet_addr: 10.0.0.1 MTU: 1500 Metric: 1
+name: eth0 inet_addr: 10.0.1.1 MTU: 1500 Metric: 1
+ifconfigend.
+
+route:
+192.168.0.0 10.0.0.1 255.255.255.0 H 0 eth1
+192.168.1.0 10.0.1.1 255.255.255.0 H 0 eth0
+routeend.
View
2 examples/dhcp/wlan/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+../../src/run_inet $*
View
1 examples/dhcp/wlan/run.cmd
@@ -0,0 +1 @@
+..\..\src\run_inet %*
View
9 examples/dhcp/wlan/wirelessRouter.rt
@@ -0,0 +1,9 @@
+ifconfig:
+name: wlan0 inet_addr: 192.168.0.1 Mask: 255.255.255.0 MTU: 1500 Metric: 1
+name: eth0 inet_addr: 10.0.0.2 Mask: 255.255.255.252 MTU: 1500 Metric: 1
+ifconfigend.
+
+route:
+192.168.0.0 * 255.255.255.0 H 0 wlan0
+default: 10.0.0.1 0.0.0.0 G 0 eth0
+routeend.

0 comments on commit cdce1b7

Please sign in to comment.
Something went wrong with that request. Please try again.