| 1 |
Installing dhcp_probe |
| 2 |
|
| 3 |
|
| 4 |
Note that the file INSTALL contains generic build and |
| 5 |
installation instructions; it supplements this file (specifically, |
| 6 |
the steps involving 'configure', 'make', and 'make install'). |
| 7 |
|
| 8 |
The file PLATFORMS contains platform-specific notes. |
| 9 |
|
| 10 |
dhcp_probe is intended for use by a network administrator. Before running |
| 11 |
dhcp_probe on any network other than one for which you are responsible, |
| 12 |
contact that network's administrator to learn if it is acceptable for you |
| 13 |
to run this software on that network. Running this software may violate |
| 14 |
on a network where you don't have permission to do so may violate that |
| 15 |
network's acceptable use policy. |
| 16 |
|
| 17 |
--- |
| 18 |
|
| 19 |
1. Obtain and install libpcap, the packet capture library. |
| 20 |
Version 0.8.1 or later is required. |
| 21 |
It is available from http://www.tcpdump.org |
| 22 |
|
| 23 |
More information about which versions of libpcap the |
| 24 |
program has been successfully used with (and whether any |
| 25 |
versions should be avoided), may appear in the PLATFORMS file. |
| 26 |
|
| 27 |
If libpcap isn't supported on your platform, you can't |
| 28 |
use dhcp_probe. |
| 29 |
|
| 30 |
Libpcap must be installed to compile dhcp_probe; |
| 31 |
we assume we'll find the libpcap library and header files |
| 32 |
in either /usr/local or the other usual places the compiler |
| 33 |
and linker will search. If you've installed it elsewhere, |
| 34 |
when you run 'configure' below, remember to specify the |
| 35 |
--with-pcap=DIR option. |
| 36 |
|
| 37 |
-- |
| 38 |
|
| 39 |
2. Obtain and install libnet 1.1.x, the packet writing library. |
| 40 |
It is available from http://packetfactory.openwall.net/projects/libnet/index.html |
| 41 |
|
| 42 |
The current version of this program uses the libnet 1.1.x API. |
| 43 |
It does not support the libnet 1.0.x API. (The last version of |
| 44 |
this program that supported the libnet 1.0.x API was version 1.0.7.) |
| 45 |
|
| 46 |
More information about which versions of libnet the |
| 47 |
program has been successfully used with (and whether any |
| 48 |
versions should be avoided), may appear in the PLATFORMS file. |
| 49 |
|
| 50 |
If libnet 1.1.x isn't supported on your platform, you can't |
| 51 |
use dhcp_probe. |
| 52 |
|
| 53 |
Libnet must be installed to compile this program; |
| 54 |
we assume we'll find the libnet library and header files |
| 55 |
in either /usr/local or the other usual places the compiler |
| 56 |
and linker will search. If you've installed it elsewhere, |
| 57 |
when you run 'configure' below, remember to specify the |
| 58 |
--with-libnet=DIR option. |
| 59 |
|
| 60 |
Additionally, if you are using libnet older than version 1.3, |
| 61 |
you likely need to modify libnet to add a function |
| 62 |
that we need to use. This function is not present in libnet 1.1.x |
| 63 |
until version 1.3, so you will need to patch libnet. |
| 64 |
|
| 65 |
In the libnet source directory, edit ./src/libnet_cq.c to add the following |
| 66 |
at the end: |
| 67 |
|
| 68 |
u_int32_t |
| 69 |
libnet_cq_end_loop() |
| 70 |
{ |
| 71 |
|
| 72 |
if (! clear_cq_lock(CQ_LOCK_WRITE)) |
| 73 |
{ |
| 74 |
return (0); |
| 75 |
} |
| 76 |
l_cqd.current = l_cq; |
| 77 |
return (1); |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
In the libnet source directory, edit ./include/libnet/libnet-functions.h |
| 82 |
to add the following at the end: |
| 83 |
|
| 84 |
u_int32_t |
| 85 |
libnet_cq_end_loop(); |
| 86 |
|
| 87 |
|
| 88 |
Additionally, if you are using libnet version up through version 1.2rc3, |
| 89 |
you should modify libnet to fix a bug that we would otherwise trigger |
| 90 |
when handling SIGHUP. (This bug fix was commited after libnet 1.2rc3, |
| 91 |
so is expected to be in the next libnet release after that.) |
| 92 |
|
| 93 |
In the libnet source directory, edit ./src/libnet_cq.c to modify |
| 94 |
libnet_cq_destroy() to append the following two statements to the |
| 95 |
end of the function: |
| 96 |
|
| 97 |
l_cq = NULL; |
| 98 |
memset(&l_cqd, 0, sizeof(l_cqd)); |
| 99 |
|
| 100 |
You will need to rebuild and install libnet to incorporate these changes. |
| 101 |
|
| 102 |
|
| 103 |
--- |
| 104 |
|
| 105 |
3. `cd' to the directory containing the package's source code and type |
| 106 |
`./configure' to configure the package for your system. |
| 107 |
|
| 108 |
You may need to specify the --with-pcap=DIR option if configure is unable to |
| 109 |
locate the libpcap header and library. If the header and library don't share |
| 110 |
a common parent, the more specific options --with-pcap-include=DIR and |
| 111 |
--with-pcap-lib=DIR may be useful. |
| 112 |
|
| 113 |
You may need to specify the --with-libnet=DIR option if configure is unable to |
| 114 |
locate the libnet header and library. If the header and library don't share |
| 115 |
a common parent, the more specific options --with-libnet-include=DIR and |
| 116 |
--with-libnet-lib=DIR may be helpful. For example, on some platforms, |
| 117 |
libnet 1.1.x is installed below /usr/include/libnet11/ and /usr/lib/libnet11/. |
| 118 |
|
| 119 |
More information about running 'configure' is available in the INSTALL |
| 120 |
file, and you may type './configure --help' for a summary of options. |
| 121 |
|
| 122 |
Additional notes about some platforms may be in the PLATFORMS file. |
| 123 |
|
| 124 |
--- |
| 125 |
|
| 126 |
4. Type `make' to compile the package. |
| 127 |
|
| 128 |
Ignore the following compiler warning: |
| 129 |
|
| 130 |
bootp.c: In function `build_dhcp_payload': |
| 131 |
bootp.c:80: warning: assignment from incompatible pointer type |
| 132 |
|
| 133 |
If you see an error about libnet_cq_end_loop() being unknown, |
| 134 |
see the earlier step about modifying libnet to add this function. |
| 135 |
|
| 136 |
--- |
| 137 |
|
| 138 |
5. Type `make install' to install the package. |
| 139 |
|
| 140 |
--- |
| 141 |
|
| 142 |
6. Create a configuration file dhcp_probe.cf in an appropriate location. |
| 143 |
|
| 144 |
The default location for this file is /etc/dhcp_probe.cf, but you can put it |
| 145 |
elsewhere, as long as you specify the new location when you run the program |
| 146 |
using the appropriate command-line option. |
| 147 |
|
| 148 |
A sample configuration file is supplied in the 'extras' directory; you may wish |
| 149 |
to use it as a template. |
| 150 |
|
| 151 |
7. Verify that the /etc/services file (or NIS 'services' map, whichever is |
| 152 |
in-use) contains entries for 'bootpc' and 'bootps'. If they are not |
| 153 |
present, add them: |
| 154 |
|
| 155 |
bootps 67/udp # BOOTP/DHCP server |
| 156 |
bootpc 68/udp # BOOTP/DHCP client |
| 157 |
|
| 158 |
--- |
| 159 |
|
| 160 |
8. To get started, try running it in the foreground and seeing if the debug messages |
| 161 |
seem reasonable to you. E.g. as root: |
| 162 |
|
| 163 |
/usr/local/sbin/dhcp_probe -f -d 11 hme0 |
| 164 |
|
| 165 |
The -f option prevents it from forking, and also causes all output to be |
| 166 |
sent to stderr instead of to syslog. Debuglevel 11 will produce maximum |
| 167 |
debugging. Specify the name of the interface on which to run, e.g. 'hme0'. |
| 168 |
|
| 169 |
--- |
| 170 |
|
| 171 |
9. Verify that the probe packets transmitted by dhcp_probe are truly reaching |
| 172 |
the network. Do so by performing packet capture from another device on |
| 173 |
the network. |
| 174 |
|
| 175 |
Do not skip this step, as it may help you discover whether some problem |
| 176 |
is silently causing the packets to never reach the network. |
| 177 |
|
| 178 |
Do not rely on packet capture performed from the device running dhcp_probe, |
| 179 |
as such capture will likely see the outgoing packets on their way to the |
| 180 |
network interface, rather than the actual packets on the network. |
| 181 |
|
| 182 |
--- |
| 183 |
|
| 184 |
10. Arrange to have the program started automatically by root when your host starts. |
| 185 |
Some sample startup scripts are in the extras directory. |
| 186 |
|
| 187 |
Never specify the -f flag when starting the daemon from a startup script; |
| 188 |
this flag should never be specified except for debugging purposes. |
| 189 |
|
| 190 |
You'll probably want to reduce the debuglevel; a debuglevel of 0 or 1 is generally |
| 191 |
a good choice for production use. |
| 192 |
|
| 193 |
Output will be directed to syslog (using the facility specified |
| 194 |
in defaults.h); you'll want to configure syslogd to do something reasonable |
| 195 |
with it. (You can change the syslog facility name by editing defaults.h and |
| 196 |
recompiling.) Alternatively, use the -l option to specify a logfile to receive output; |
| 197 |
this prevents syslog from being used. |
| 198 |
|
| 199 |
--- |
| 200 |
|
| 201 |
11. If you want to capture packets received from unknown servers, add the -o |
| 202 |
option when starting up, to specify a capture file. Be sure to specify |
| 203 |
a directory for the capture file that no one may write to except root; |
| 204 |
see the dhcp_probe(8) man page for details. |
| 205 |
|
| 206 |
Since the program truncates this file each time it starts, you may want to |
| 207 |
modify the script you use to start the program, to save the old version of |
| 208 |
this file before starting the program. |
| 209 |
|
| 210 |
--- |
| 211 |
|
| 212 |
12. Any additional tools you may find useful can be found in the 'extras' directory. |
| 213 |
For example, extras/dhcp_probe_notify2 is a sample notification script that |
| 214 |
may be called via the 'alert_program_name2' configuration file statement. |
| 215 |
There are some sample startup scripts in that directory as well. |
| 216 |
See the README file in that directory. |
| 217 |
|
| 218 |
--- |