17 */ |
17 */ |
18 |
18 |
19 // Allow ns-3 to ping a real host somewhere, using emulation mode and ping |
19 // Allow ns-3 to ping a real host somewhere, using emulation mode and ping |
20 // the simulated node from the host. |
20 // the simulated node from the host. |
21 // |
21 // |
22 // ------------------ |
22 // +-------------------------------------+ |
23 // | ns-3 simulation | |
23 // | host | |
24 // | | |
24 // +-------------------------------------+ |
25 // | ------- | |
25 // | ns-3 simulation | | |
26 // | | node | | |
26 // +----------------------+ | |
27 // | ------- | |
27 // | ns-3 Node | | |
28 // | | fd- | | |
28 // | +----------------+ | | |
29 // | | net- | | |
29 // | | ns-3 TCP | | | |
30 // | | device| | |
30 // | +----------------+ | | |
31 // | ------- | |
31 // | | ns-3 IPv4 | | | |
32 // | | | |
32 // | +----------------+ | | |
33 // | | | |
33 // | | FdNetDevice | | | |
34 // ----|------------- |
34 // |--+----------------+--+ +------+ | |
35 // | --- --- | |
35 // | | TAP | | eth0 | | |
36 // | | | | | | |
36 // | +------+ +------+ | |
37 // | |TAP| |ETH| | |
37 // | 1.2.3.4 | | |
38 // | | | | | | |
38 // +-------------------------------|-----+ |
39 // | --- --- | |
39 // | |
40 // | | | |
40 // | |
41 // | host | | |
41 // ------------ (Internet) ----- |
42 // --------------|---- |
42 // |
43 // | |
|
44 // | |
|
45 // ---- (Internet) ------- |
|
46 // |
43 // |
47 // To use this example: |
44 // To use this example: |
48 // 1) ns-3 will create the TAP device for you in the host machine. |
45 // 1) ns-3 will create the TAP device for you in the host machine. |
49 // For this you need to provide the network address to allocate IP addresses |
46 // For this you need to provide the network address to allocate IP addresses |
50 // for the TAP device and the ns-3 FdNetDevice. |
47 // for the TAP device and the ns-3 FdNetDevice. |
58 // reach back the TAP. |
55 // reach back the TAP. |
59 // - TAP-network-address is the same as 'tapNetwork' |
56 // - TAP-network-address is the same as 'tapNetwork' |
60 // - net-device-ip is be the IP address of the network device connected to the internet |
57 // - net-device-ip is be the IP address of the network device connected to the internet |
61 // # iptables -t nat -A POSTROUTING -s <TAP-network-addres>/24 -j SNAT --to-source <net-device-ip> |
58 // # iptables -t nat -A POSTROUTING -s <TAP-network-addres>/24 -j SNAT --to-source <net-device-ip> |
62 // |
59 // |
63 // 3) Before running the example make sure that the tap creator binary has root suid |
60 // 3) Before running the example make sure that the tap creator binary has root suid. |
|
61 // If the --enable-sudo option was used to configure ns-3 with waf, then the following |
|
62 // step will not be necessary. |
64 // |
63 // |
65 // # chown root.root build/src/fd-net-device/ns3-dev-tap-device-creator |
64 // # chown root.root build/src/fd-net-device/ns3-dev-tap-device-creator |
66 // # sudo chmod 4755 build/src/fd-net-device/ns3-dev-tap-device-creator |
65 // # sudo chmod 4755 build/src/fd-net-device/ns3-dev-tap-device-creator |
67 // |
66 // |
68 |
67 |