7 over a real network. The emulated net device relies on a specified interface |
7 over a real network. The emulated net device relies on a specified interface |
8 being in promiscuous mode. It opens a raw socket and binds to that interface. |
8 being in promiscuous mode. It opens a raw socket and binds to that interface. |
9 We perform MAC spoofing to separate simulation network traffic from other |
9 We perform MAC spoofing to separate simulation network traffic from other |
10 network traffic that may be flowing to and from the host. |
10 network traffic that may be flowing to and from the host. |
11 |
11 |
12 Normally, the use case for emulated net devices is in collections of small |
12 One can use the @code{Emu} net device in a testbed situation where the |
13 simulations that connect to the outside world through specific interfaces. |
|
14 For example, one could construct a number of virtual machines and connect them |
|
15 via a host-only network. To use the emulated net device, you would need to |
|
16 set all of the host-only interfaces in promiscuous mode and provide an |
|
17 appropriate device name, "eth1" for example. |
|
18 |
|
19 One could also use the @code{Emu} net device in a testbed situation where the |
|
20 host on which the simulation is running has a specific interface of interest |
13 host on which the simulation is running has a specific interface of interest |
21 which drives the testbed hardware. You would also need to set this specific |
14 which drives the testbed hardware. You would also need to set this specific |
22 interface into promiscuous mode and provide an appropriate device name to the |
15 interface into promiscuous mode and provide an appropriate device name to the |
23 ns-3 emulated net device. An example of this environment is the ORBIT testbed |
16 ns-3 emulated net device. An example of this environment is the ORBIT testbed |
24 as described above. |
17 as described above. |
46 |
39 |
47 The emulated net device comes with a helper function as all ns-3 devices do. |
40 The emulated net device comes with a helper function as all ns-3 devices do. |
48 One unique aspect is that there is no channel associated with the underlying |
41 One unique aspect is that there is no channel associated with the underlying |
49 medium. We really have no idea what this external medium is, and so have not |
42 medium. We really have no idea what this external medium is, and so have not |
50 made an effort to model it abstractly. The primary thing to be aware of is the |
43 made an effort to model it abstractly. The primary thing to be aware of is the |
51 implication this has for static global routing. The global router module |
44 implication this has for IPv4 global routing. The global router module |
52 attempts to walk the channels looking for adjacent networks. Since there |
45 attempts to walk the channels looking for adjacent networks. Since there |
53 is no channel, the global router will be unable to do this and you must then |
46 is no channel, the global router will be unable to do this and you must then |
54 use a dynamic routing protocol such as OLSR to include routing in |
47 use a dynamic routing protocol such as OLSR to include routing in |
55 @code{Emu}-based networks. |
48 @code{Emu}-based networks. |
56 |
49 |
69 with this device is in network configuration before even starting a simulation, |
62 with this device is in network configuration before even starting a simulation, |
70 you may want to take a moment to review a couple of HOWTO pages on the ns-3 wiki |
63 you may want to take a moment to review a couple of HOWTO pages on the ns-3 wiki |
71 that describe how to set up a virtual test network using VMware and how to run |
64 that describe how to set up a virtual test network using VMware and how to run |
72 a set of example (client server) simulations that use @code{Emu} net devices. |
65 a set of example (client server) simulations that use @code{Emu} net devices. |
73 |
66 |
74 @uref{http://www.nsnam.org/wiki/index.php/HOWTO_use_VMware_to_set_up_virtual_networks_(Windows)} |
67 @itemize @bullet |
75 @uref{http://www.nsnam.org/wiki/index.php/HOWTO_use_ns-3_scripts_to_drive_real_hardware_(experimental)} |
68 @item @uref{http://www.nsnam.org/wiki/index.php/HOWTO_use_VMware_to_set_up_virtual_networks_(Windows)} |
|
69 @item @uref{http://www.nsnam.org/wiki/index.php/HOWTO_use_ns-3_scripts_to_drive_real_hardware_(experimental)} |
|
70 @end itemize |
76 |
71 |
77 Once you are over the configuration hurdle, the script changes required to use |
72 Once you are over the configuration hurdle, the script changes required to use |
78 an @code{Emu} device are trivial. The main structural difference is that you |
73 an @code{Emu} device are trivial. The main structural difference is that you |
79 will need to create an ns-3 simulation script for each node. In the case of |
74 will need to create an ns-3 simulation script for each node. In the case of |
80 the HOWTOs above, there is one client script and one server script. The only |
75 the HOWTOs above, there is one client script and one server script. The only |
100 @verbatim |
95 @verbatim |
101 // |
96 // |
102 // We've got the devices in place. Since we're using MAC address |
97 // We've got the devices in place. Since we're using MAC address |
103 // spoofing under the sheets, we need to make sure that the MAC addresses |
98 // spoofing under the sheets, we need to make sure that the MAC addresses |
104 // we have assigned to our devices are unique. Ns-3 will happily |
99 // we have assigned to our devices are unique. Ns-3 will happily |
105 // automatically assign the same MAC addresses to the devices in both halves |
100 // automatically assign the same MAC address to the devices in both halves |
106 // of our two-script pair, so let's go ahead and just manually change them |
101 // of our two-script pair, so let's go ahead and just manually change them |
107 // to something we ensure is unique. |
102 // to something we ensure is unique. |
108 // |
103 // |
109 Ptr<NetDevice> nd = d.Get (0); |
104 Ptr<NetDevice> nd = d.Get (0); |
110 Ptr<EmuNetDevice> ed = nd->GetObject<EmuNetDevice> (); |
105 Ptr<EmuNetDevice> ed = nd->GetObject<EmuNetDevice> (); |