bridge 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. .TH BRIDGE 3
  2. .SH NAME
  3. bridge \- IPv4 Ethernet bridge
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -a #B\fIb\fP /net
  7. .B /net/bridge\fIb\fP/ctl
  8. .B /net/bridge\fIb\fP/cache
  9. .B /net/bridge\fIb\fP/log
  10. .B /net/bridge\fIb\fP/stats
  11. .BI /net/bridge\fIb\fP/ n
  12. .BI /net/bridge\fIb\fP/ n /ctl
  13. .BI /net/bridge\fIb\fP/ n /local
  14. .BI /net/bridge\fIb\fP/ n /status
  15. .fi
  16. .SH DESCRIPTION
  17. The
  18. .I bridge
  19. device bridges IPv4 packets amongst Ethernet interfaces.
  20. The number
  21. .I b
  22. in the bind is optional and selects a particular bridge
  23. (default 0).
  24. .PP
  25. The
  26. .B /net/bridge0
  27. directory contains
  28. .BR ctl ,
  29. .BR cache ,
  30. .BR log ,
  31. and
  32. .B stats
  33. files, and numbered subdirectories for each physical interface.
  34. .PP
  35. Opening the
  36. .B ctl
  37. file reserves an interface.
  38. The file descriptor returned from the
  39. .IR open (2)
  40. will point to the control file,
  41. .BR ctl ,
  42. of the newly allocated interface.
  43. Reading
  44. .B ctl
  45. returns a text string representing the number of the interface.
  46. Writing
  47. .B ctl
  48. alters aspects of the interface.
  49. The possible
  50. .I ctl
  51. messages are:
  52. .TF cacheflush
  53. .PD
  54. .TP
  55. .BI "bind ether " "name ownhash path"
  56. Treat the device mounted at
  57. .I path
  58. (e.g.,
  59. .LR /net/ether0 )
  60. as an Ethernet medium carrying IPv4 and ARP packets
  61. and associate it with this bridge (forward its packets to the
  62. other interfaces associated with this bridge).
  63. .I Ownhash
  64. is an `owner hash'.
  65. .TP
  66. .BI "bind tunnel " "name ownhash path path2
  67. Treat the device mounted at
  68. .I path
  69. as a network tunnel carrying IPv4 and ARP packets,
  70. the device mounted at
  71. .I path2
  72. as an Ethernet medium carrying IPv4 and ARP packets
  73. and associate them with this bridge
  74. (forward its packets to the
  75. other interfaces associated with this bridge).
  76. Read packets from the
  77. .I path
  78. interface and write them to the
  79. .I path2
  80. interface.
  81. Such tunnels have an MTU of 1400 bytes.
  82. .TP
  83. .BI "unbind " "type address [ownhash]"
  84. Disassociate the interface associated with
  85. .I address
  86. from this bridge.
  87. .I Type
  88. must be
  89. .L ether
  90. or
  91. .LR tunnel .
  92. .TP
  93. .B cacheflush
  94. Clear the cache of (destination MAC address, port) tuples.
  95. .TP
  96. .BI "delay " "delay0 delayn"
  97. Set the
  98. .I delay0
  99. and
  100. .I delayn
  101. parameters.
  102. .I delay0
  103. is the constant microsecond delay per packet
  104. and
  105. .I delayn
  106. is the microsecond delay per byte.
  107. .TP
  108. .BI "set " option
  109. Set bridge
  110. .IR option .
  111. The only known option is
  112. .LR tcpmss ,
  113. which limits the TCP Maximum Segment Size of
  114. TCPv4 packets passing through to 1300 bytes.
  115. .TP
  116. .BI "clear " option
  117. Clear bridge
  118. .IR option .
  119. .PP
  120. Reading
  121. .I stats
  122. returns statistics about the bridge.
  123. .PP
  124. Reading the
  125. .I log
  126. file returns data from the bridge's log
  127. and will block at end of file awaiting new data.
  128. .PP
  129. Reading the
  130. .B cache
  131. file prints the cache of (destination MAC address, port) tuples,
  132. one entry per line.
  133. The format is:
  134. the destination MAC (e.g., Ethernet) address in hex,
  135. port number,
  136. count of packets from this address,
  137. count of packets to this address,
  138. expiry time in seconds since the epoch,
  139. and
  140. .L e
  141. for expired entries or
  142. .L v
  143. for valid entries.
  144. .PP
  145. In a connection subdirectory,
  146. .B ctl
  147. and
  148. .B local
  149. don't do anything,
  150. but
  151. .B status
  152. returns a one-line status summary.
  153. .SH EXAMPLES
  154. Set up a network bridge between two Ethernets
  155. .RL ( #l0
  156. and
  157. .LR #l1 ).
  158. .IP
  159. .EX
  160. bind -a '#B' /net
  161. bind -a '#l1' /net
  162. echo 'bind ether outer 0 /net/ether0' >/net/bridge0/ctl
  163. echo 'bind ether inner 0 /net/ether1' >/net/bridge0/ctl
  164. .EE
  165. .SH "SEE ALSO"
  166. .IR ip (3)
  167. .SH SOURCE
  168. .B /sys/src/9/port/devbridge.c
  169. .SH BUGS
  170. Doesn't understand IPv6.