tcpbridge.1 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. .TH TCPBRIDGE 1 2007-04-21 "(tcpbridge )" "Programmer's Manual"
  2. .\" DO NOT EDIT THIS FILE (tcpbridge.1)
  3. .\"
  4. .\" It has been AutoGen-ed Saturday April 21, 2007 at 10:41:06 AM PDT
  5. .\" From the definitions tcpbridge_opts.def
  6. .\" and the template file agman1.tpl
  7. .\"
  8. .SH NAME
  9. tcpbridge \- Bridge network traffic across two interfaces
  10. .SH SYNOPSIS
  11. .B tcpbridge
  12. .\" Mixture of short (flag) options and long options
  13. .RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
  14. .PP
  15. All arguments must be options.
  16. .PP
  17. tcpbridge is a tool for selectively briding network traffic across two interfaces
  18. and optionally modifying the packets in betweeen
  19. .SH "DESCRIPTION"
  20. This manual page documents, briefly, the \fBtcpbridge\fP command.
  21. The basic operation of tcpbridge is to be a network bridge between two
  22. subnets. All packets received on one interface are sent via the other.
  23. Optionally, packets can be edited in a variety of ways according to your needs.
  24. For more details, please see the Tcpreplay Manual at:
  25. http://tcpreplay.synfin.net/wiki/manual
  26. .SH OPTIONS
  27. .SS ""
  28. .TP
  29. .BR \-r " \fIstring\fP, " \--portmap "=" \fIstring\fP
  30. Rewrite TCP/UDP ports.
  31. This option may appear up to 1 times.
  32. .sp
  33. Specify a list of comma delimited port mappingings consisting of
  34. colon delimited port number pairs. Each colon delimited port pair
  35. consists of the port to match followed by the port number to rewrite.
  36. Example:
  37. .nf
  38. \--portmap=80:8000,8080:80
  39. .fi
  40. .TP
  41. .BR \-s " \fInumber\fP, " \--seed "=" \fInumber\fP
  42. Randomize src/dst IP addresses w/ given seed.
  43. This option may appear up to 1 times.
  44. This option takes an integer number as its argument.
  45. .sp
  46. Causes the source and destination IP addresses to be pseudo
  47. randomized but still maintain client/server relationships.
  48. Since the randomization is deterministic based on the seed,
  49. you can reuse the same seed value to recreate the traffic.
  50. .TP
  51. .BR \-N " \fIstring\fP, " \--pnat "=" \fIstring\fP
  52. Rewrite IP addresses using pseudo-NAT.
  53. This option may appear up to 2 times.
  54. .sp
  55. Takes a comma delimited series of colon delimited CIDR
  56. netblock pairs. Each netblock pair is evaluated in order against
  57. the IP addresses. If the IP address in the packet matches the
  58. first netblock, it is rewriten using the second netblock as a
  59. mask against the high order bits.
  60. Example:
  61. .nf
  62. \--pnat=192.168.0.0/16:10.77.0.0/16,172.16.0.0/12:10.1.0.0/24
  63. .fi
  64. .TP
  65. .BR \-e " \fIstring\fP, " \--endpoints "=" \fIstring\fP
  66. Rewrite IP addresses to be between two endpoints.
  67. This option may appear up to 1 times.
  68. This option must appear in combination with the following options:
  69. cachefile.
  70. .sp
  71. Takes a pair of colon delimited IP addresses which will be used to rewrite
  72. all traffic to appear to be between the two IP's.
  73. Example:
  74. .nf
  75. \--endpoints=172.16.0.1:172.16.0.2
  76. .fi
  77. .TP
  78. .BR \-b ", " \--skipbroadcast
  79. Skip rewriting broadcast/multicast IP's.
  80. .sp
  81. By default \--seed, \--pnat and \--endpoints will rewrite
  82. broadcast and multicast IP and MAC addresses. Setting this flag
  83. will keep broadcast/multicast IP and MAC addresses from being rewritten.
  84. .TP
  85. .BR \-C ", " \--fixcsum
  86. Force recalculation of IP/TCP/UDP checksums.
  87. .sp
  88. Causes each IP packet to have it's checksums recalcualted and
  89. fixed. Automatically enabled for packets modified with \fB--seed\fP,
  90. \fB--pnat\fP, \fB--endpoints\fP or \fB--fixlen\fP.
  91. .TP
  92. .BR \-m " \fInumber\fP, " \--mtu "=" \fInumber\fP
  93. Override default MTU length (1500 bytes).
  94. This option may appear up to 1 times.
  95. This option takes an integer number as its argument.
  96. The value of \fInumber\fP is constrained to being:
  97. .in +4
  98. .nf
  99. .na
  100. in the range 1 through MAXPACKET
  101. .fi
  102. .in -4
  103. .sp
  104. Override the default 1500 byte MTU size for determining the maximum padding length.
  105. .TP
  106. .BR \-E ", " \--efcs
  107. Remove Ethernet checksums (FCS) from end of frames.
  108. .sp
  109. Note, this option is pretty dangerous! We don't actually check to see if a FCS
  110. actually exists in the frame, we just blindly delete the last two bytes. Hence,
  111. you should only use this if you know know that your OS provides the FCS when
  112. reading raw packets.
  113. .TP
  114. .BR \-F " \fIstring\fP, " \--fixlen "=" \fIstring\fP
  115. Pad or truncate packet data to match header length.
  116. This option may appear up to 1 times.
  117. .sp
  118. Packets may be truncated during capture if the snaplen is smaller then the
  119. packet. This option allows you to modify the packet to pad the packet back
  120. out to the size stored in the IPv4 header or rewrite the IP header total length
  121. to reflect the stored packet length.
  122. .sp 1
  123. \fBpad\fP
  124. Truncated packets will be padded out so that the packet length matches the
  125. IPv4 total length
  126. .sp 1
  127. \fBtrunc\fP
  128. Truncated packets will have their IPv4 total length field rewritten to match
  129. the actual packet length
  130. .sp 1
  131. \fBdel\fP
  132. Delete the packet
  133. .TP
  134. .BR \--skipl2broadcast
  135. Skip rewriting broadcast/multicast Layer 2 addresses.
  136. .sp
  137. By default, editing Layer 2 addresses will rewrite
  138. broadcast and multicast MAC addresses. Setting this flag
  139. will keep broadcast/multicast MAC addresses from being rewritten.
  140. .TP
  141. .BR \--dlt "=\fIstring\fP"
  142. Override output DLT encapsulation.
  143. This option may appear up to 1 times.
  144. .sp
  145. By default, no DLT (data link type) conversion will be made.
  146. To change the DLT type of the output pcap, select one of the following values:
  147. .sp 1
  148. \fBenet\fP
  149. Ethernet aka DLT_EN10MB
  150. .sp 1
  151. \fBhdlc\fP
  152. Cisco HDLC aka DLT_C_HDLC
  153. .sp 1
  154. \fBuser\fP
  155. User specified Layer 2 header and DLT type
  156. .sp 1
  157. .br
  158. .TP
  159. .BR \--enet-dmac "=\fIstring\fP"
  160. Override destination ethernet MAC addresses.
  161. This option may appear up to 1 times.
  162. .sp
  163. Takes a pair of comma deliminated ethernet MAC addresses which
  164. will replace the destination MAC address of outbound packets.
  165. The first MAC address will be used for the server to client traffic
  166. and the optional second MAC address will be used for the client
  167. to server traffic.
  168. Example:
  169. .nf
  170. \--enet-dmac=00:12:13:14:15:16,00:22:33:44:55:66
  171. .fi
  172. .TP
  173. .BR \--enet-smac "=\fIstring\fP"
  174. Override source ethernet MAC addresses.
  175. This option may appear up to 1 times.
  176. .sp
  177. Takes a pair of comma deliminated ethernet MAC addresses which
  178. will replace the source MAC address of outbound packets.
  179. The first MAC address will be used for the server to client traffic
  180. and the optional second MAC address will be used for the client
  181. to server traffic.
  182. Example:
  183. .nf
  184. \--enet-smac=00:12:13:14:15:16,00:22:33:44:55:66
  185. .fi
  186. .TP
  187. .BR \--enet-vlan "=\fIstring\fP"
  188. Specify ethernet 802.1q VLAN tag mode.
  189. This option may appear up to 1 times.
  190. .sp
  191. Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3
  192. ethernet headers or remove the 802.1q VLAN tag information.
  193. .sp 1
  194. \fBadd\fP
  195. Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header
  196. .sp 1
  197. \fBdel\fP
  198. Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header
  199. .TP
  200. .BR \--enet-vlan-tag "=\fInumber\fP"
  201. Specify the new ethernet 802.1q VLAN tag value.
  202. This option may appear up to 1 times.
  203. This option must appear in combination with the following options:
  204. enet-vlan.
  205. This option takes an integer number as its argument.
  206. The value of \fInumber\fP is constrained to being:
  207. .in +4
  208. .nf
  209. .na
  210. in the range 0 through 4095
  211. .fi
  212. .in -4
  213. .sp
  214. .TP
  215. .BR \--enet-vlan-cfi "=\fInumber\fP"
  216. Specify the ethernet 802.1q VLAN CFI value.
  217. This option may appear up to 1 times.
  218. This option must appear in combination with the following options:
  219. enet-vlan.
  220. This option takes an integer number as its argument.
  221. The value of \fInumber\fP is constrained to being:
  222. .in +4
  223. .nf
  224. .na
  225. in the range 0 through 1
  226. .fi
  227. .in -4
  228. .sp
  229. .TP
  230. .BR \--enet-vlan-pri "=\fInumber\fP"
  231. Specify the ethernet 802.1q VLAN priority.
  232. This option may appear up to 1 times.
  233. This option must appear in combination with the following options:
  234. enet-vlan.
  235. This option takes an integer number as its argument.
  236. The value of \fInumber\fP is constrained to being:
  237. .in +4
  238. .nf
  239. .na
  240. in the range 0 through 7
  241. .fi
  242. .in -4
  243. .sp
  244. .TP
  245. .BR \--hdlc-control "=\fInumber\fP"
  246. Specify HDLC control value.
  247. This option may appear up to 1 times.
  248. This option takes an integer number as its argument.
  249. .sp
  250. The Cisco HDLC header has a 1 byte "control" field. Apparently this should
  251. always be 0, but if you can use any 1 byte value.
  252. .TP
  253. .BR \--hdlc-address "=\fInumber\fP"
  254. Specify HDLC address.
  255. This option may appear up to 1 times.
  256. This option takes an integer number as its argument.
  257. .sp
  258. The Cisco HDLC header has a 1 byte "address" field which has two valid
  259. values:
  260. .sp 1
  261. \fB0x0F\fP
  262. Unicast
  263. .sp 1
  264. \fB0xBF\fP
  265. Broadcast
  266. .br
  267. You can however specify any single byte value.
  268. .TP
  269. .BR \--user-dlt "=\fInumber\fP"
  270. Set output file DLT type.
  271. This option may appear up to 1 times.
  272. This option takes an integer number as its argument.
  273. .sp
  274. Set the DLT value of the output pcap file.
  275. .TP
  276. .BR \--user-dlink "=\fIstring\fP"
  277. Rewrite Data-Link layer with user specified data.
  278. This option may appear up to 2 times.
  279. .sp
  280. Provide a series of comma deliminated hex values which will be
  281. used to rewrite or create the Layer 2 header of the packets.
  282. The first instance of this argument will rewrite both server
  283. and client traffic, but if this argument is specified a second
  284. time, it will be used for the client traffic.
  285. Example:
  286. .nf
  287. \--user-dlink=01,02,03,04,05,06,00,1A,2B,3C,4D,5E,6F,08,00
  288. .fi
  289. .TP
  290. .BR \-d " \fInumber\fP, " \--dbug "=" \fInumber\fP
  291. Enable debugging output.
  292. This option may appear up to 1 times.
  293. This option takes an integer number as its argument.
  294. The value of \fInumber\fP is constrained to being:
  295. .in +4
  296. .nf
  297. .na
  298. in the range 0 through 5
  299. .fi
  300. .in -4
  301. The default \fInumber\fP for this option is:
  302. .ti +4
  303. 0
  304. .sp
  305. If configured with \--enable-debug, then you can specify a verbosity
  306. level for debugging output. Higher numbers increase verbosity.
  307. .TP
  308. .BR \-i " \fIstring\fP, " \--intf1 "=" \fIstring\fP
  309. Primary interface (listen in uni-directional mode).
  310. This option may appear up to 1 times.
  311. .sp
  312. .TP
  313. .BR \-I " \fIstring\fP, " \--intf2 "=" \fIstring\fP
  314. Secondary interface (send in uni-directional mode).
  315. This option may appear up to 1 times.
  316. .sp
  317. .TP
  318. .BR \-u ", " \--unidir
  319. Send and receive in only one direction.
  320. This option may appear up to 1 times.
  321. .sp
  322. Normally, tcpbridge will send and receive traffic in both directions
  323. (bi-directionally). However, if you choose this option, traffic will
  324. be sent uni-directionally.
  325. .TP
  326. .BR \-L " \fInumber\fP, " \--limit "=" \fInumber\fP
  327. Limit the number of packets to send.
  328. This option may appear up to 1 times.
  329. This option takes an integer number as its argument.
  330. The value of \fInumber\fP is constrained to being:
  331. .in +4
  332. .nf
  333. .na
  334. greater than or equal to 1
  335. .fi
  336. .in -4
  337. The default \fInumber\fP for this option is:
  338. .ti +4
  339. \-1
  340. .sp
  341. By default, tcpbridge will send packets forever or until Ctrl-C. Alternatively,
  342. you can specify a maximum number of packets to send.
  343. .TP
  344. .BR \-x " \fIstring\fP, " \--include "=" \fIstring\fP
  345. Include only packets matching rule.
  346. This option may appear up to 1 times.
  347. This option must not appear in combination with any of the following options:
  348. exclude.
  349. .sp
  350. Override default of sending all packets stored in the capture file and only
  351. send packets which match the provided rule. Rules can be one of:
  352. .sp
  353. .IR "S:<CIDR1>,... "
  354. - Source IP must match specified CIDR(s)
  355. .sp
  356. .IR "D:<CIDR1>,... "
  357. - Destination IP must match specified CIDR(s)
  358. .sp
  359. .IR "B:<CIDR1>,... "
  360. - Both source and destination IP must match specified CIDR(s)
  361. .sp
  362. .IR "E:<CIDR1>,... "
  363. - Either IP must match specified CIDR(s)
  364. .sp
  365. .IR "P:<LIST> "
  366. - Must be one of the listed packets where the list
  367. corresponds to the packet number in the capture file.
  368. .nf
  369. \--include=P:1-5,9,15,72-
  370. .fi
  371. would send packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  372. end of the file
  373. .sp
  374. .IR "F:'<bpf>'"
  375. - BPF filter. See the \fItcpdump(8)\fP man page for syntax.
  376. .br
  377. .TP
  378. .BR \-X " \fIstring\fP, " \--exclude "=" \fIstring\fP
  379. Exclude any packet matching this rule.
  380. This option may appear up to 1 times.
  381. This option must not appear in combination with any of the following options:
  382. include.
  383. .sp
  384. Override default of sending all packets stored in the capture file and only
  385. send packets which do not match the provided rule. Rules can be one of:
  386. .sp
  387. .IR "S:<CIDR1>,... "
  388. - Source IP must not match specified CIDR(s)
  389. .sp
  390. .IR "D:<CIDR1>,... "
  391. - Destination IP must not match specified CIDR(s)
  392. .sp
  393. .IR "B:<CIDR1>,... "
  394. - Both source and destination IP must not match specified CIDR(s)
  395. .sp
  396. .IR "E:<CIDR1>,... "
  397. - Either IP must not match specified CIDR(s)
  398. .sp
  399. .IR "P:<LIST> "
  400. - Must not be one of the listed packets where the list
  401. corresponds to the packet number in the capture file.
  402. .nf
  403. \--exclude=P:1-5,9,15,72-
  404. .fi
  405. would drop packets 1 thru 5, the 9th and 15th packet, and packets 72 until the
  406. end of the file
  407. .br
  408. .TP
  409. .BR \-P ", " \--pid
  410. Print the PID of tcpbridge at startup.
  411. .sp
  412. .TP
  413. .BR \-v ", " \--verbose
  414. Print decoded packets via tcpdump to STDOUT.
  415. This option may appear up to 1 times.
  416. .sp
  417. .TP
  418. .BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
  419. Arguments passed to tcpdump decoder.
  420. This option may appear up to 1 times.
  421. This option must appear in combination with the following options:
  422. verbose.
  423. .sp
  424. When enabling verbose mode (\fB-v\fP) you may also specify one or more
  425. additional arguments to pass to \fBtcpdump\fP to modify the way packets
  426. are decoded. By default, \-n and \-l are used. Be sure to
  427. quote the arguments like: \--verbose="-axxx" so that they are not interpreted
  428. by tcpbridge. The following arguments are vaild:
  429. [ \-aAeNqRStuvxX ]
  430. [ \-E spi@ipaddr algo:secret,... ]
  431. [ \-s snaplen ]
  432. .TP
  433. .BR \-V ", " \--version
  434. Print version information.
  435. .sp
  436. .TP
  437. .BR \-h ", " \--less-help
  438. Display less usage information and exit.
  439. .sp
  440. .TP
  441. .BR \-H , " \--help"
  442. Display usage information and exit.
  443. .TP
  444. .BR \-! , " \--more-help"
  445. Extended usage information passed thru pager.
  446. .TP
  447. .BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
  448. Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
  449. configuration file listed in the \fBOPTION PRESETS\fP section, below.
  450. .TP
  451. .BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
  452. Load options from \fIrcfile\fP.
  453. The \fIno-load-opts\fP form will disable the loading
  454. of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
  455. out of order.
  456. .SH OPTION PRESETS
  457. Any option that is not marked as \fInot presettable\fP may be preset
  458. by loading values from configuration ("RC" or ".INI") file(s).
  459. The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
  460. In that case, the file "\fI.tcpbridgerc\fP"
  461. is searched for within that directory.
  462. .SH "SIGNALS"
  463. tcpbridge understands the following signals:
  464. .sp
  465. .IR "\fBSIGUSR1\fP"
  466. Suspend tcpbridge
  467. .sp
  468. .IR "\fBSIGCONT\fP"
  469. Restart tcpbridge
  470. .br
  471. .SH "SEE ALSO"
  472. tcpdump(1), tcpprep(1), tcprewrite(1), tcpreplay(1)
  473. .SH "BUGS"
  474. tcpbridge can only send packets as fast as your computer's interface,
  475. processor and system bus will allow.
  476. Connecting both interfaces to the same subnet may create a broadcast storm and
  477. take down the network. Improper use of the packet editing functions may have
  478. other undefined and possible negative consequences.
  479. Some operating systems by default do not allow for forging source MAC
  480. addresses. Please consult your operating system's documentation and the
  481. tcpreplay FAQ if you experiance this issue.
  482. .SH AUTHOR
  483. Copyright 2000-2007 Aaron Turner
  484. For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
  485. The latest version of this software is always available from:
  486. http://tcpreplay.synfin.net/
  487. .PP
  488. Released under the Free BSD License.
  489. .PP
  490. This manual page was \fIAutoGen\fP-erated from the \fBtcpbridge\fP
  491. option definitions.