tcpbridge.1 17 KB

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