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 implements bridging of IPv4 packets
  20. amongst Ethernet interfaces.
  21. The number
  22. .I b
  23. in the bind is optional and selects a particular bridge
  24. (default 0).
  25. .PP
  26. The
  27. .B /net/bridge0
  28. directory contains
  29. .BR ctl ,
  30. .BR cache ,
  31. .BR log ,
  32. and
  33. .B stats
  34. files, and numbered subdirectories for each physical interface.
  35. .PP
  36. Opening the
  37. .B ctl
  38. file reserves an interface.
  39. The file descriptor returned from the
  40. .IR open (2)
  41. will point to the control file,
  42. .BR ctl ,
  43. of the newly allocated interface.
  44. Reading
  45. .B ctl
  46. returns a text string representing the number of the interface.
  47. Writing
  48. .B ctl
  49. alters aspects of the interface.
  50. The possible
  51. .I ctl
  52. messages are:
  53. .TF cacheflush
  54. .PD
  55. .TP
  56. .BI "bind ether " "name ownhash path"
  57. Treat the device mounted at
  58. .I path
  59. (e.g.,
  60. .LR /net/ether0 )
  61. as an Ethernet medium carrying IPv4 and ARP packets
  62. and associate it with this bridge (forward its packets to the
  63. other interfaces associated with this bridge).
  64. .I Ownhash
  65. is an `owner hash'.
  66. .TP
  67. .BI "bind tunnel " "name ownhash path path2
  68. Treat the device mounted at
  69. .I path
  70. as a network tunnel carrying IPv4 and ARP packets,
  71. the device mounted at
  72. .I path2
  73. as an Ethernet medium carrying IPv4 and ARP packets
  74. and associate them with this bridge
  75. (forward its packets to the
  76. other interfaces associated with this bridge).
  77. Read packets from the
  78. .I path
  79. interface and write them to the
  80. .I path2
  81. interface.
  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.