tcpbridge.1 16 KB

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