bridge 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. .TH BRIDGE 3
  2. .SH NAME
  3. bridge \- IPv4 network 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 network interfaces.
  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 [path2]"
  56. Treat the device mounted at
  57. .I path
  58. as an Ethernet medium carrying IPv4 and ARP packets
  59. and associate it with this bridge (forward its packets to the
  60. other interfaces associated with this bridge).
  61. .TP
  62. .BI "bind tunnel " "name ownhash path [path2]"
  63. Treat the device mounted at
  64. .I path
  65. as a network tunnel carrying IPv4 and ARP packets
  66. and associate it with this bridge (forward its packets to the
  67. other interfaces associated with this bridge).
  68. .TP
  69. .BI "unbind " "type address [ownhash]"
  70. Disassociate the interface associated with
  71. .I address
  72. from this bridge.
  73. .I Type
  74. must be
  75. .L ether
  76. or
  77. .LR tunnel .
  78. .TP
  79. .B cacheflush
  80. Clear the cache of (IP addresses, destination MAC address, port) tuples.
  81. .TP
  82. .BI "delay " "delay0 delayn"
  83. Set the
  84. .I delay0
  85. and
  86. .I delayn
  87. parameters.
  88. .I delay0
  89. is the constant microsecond delay per packet
  90. and
  91. .I delayn
  92. is the microsecond delay per byte.
  93. .TP
  94. .BI "set " option
  95. Set bridge
  96. .IR option .
  97. The only known option is
  98. .LR tcpmss ,
  99. which limits the TCP Maximum Segment Size of
  100. packets passing through to 1300 bytes.
  101. .TP
  102. .BI "clear " option
  103. Clear bridge
  104. .IR option .
  105. .PP
  106. Reading
  107. .I stats
  108. returns statistics about the bridge.
  109. .PP
  110. Reading the
  111. .I log
  112. file returns data from the bridge's log
  113. and will block at end of file awaiting new data.
  114. .PP
  115. Reading the
  116. .B cache
  117. file prints the cache of (IP addresses, destination MAC address, port) tuples,
  118. one entry per line.
  119. .PP
  120. In a connection subdirectory,
  121. .B ctl
  122. and
  123. .B local
  124. don't do anything,
  125. but
  126. .B status
  127. returns a one-line status summary.
  128. .SH EXAMPLES
  129. Set up a network bridge between two Ethernets
  130. .RL ( #l0
  131. and
  132. .LR #l1 ).
  133. .IP
  134. .EX
  135. bind -a '#B' /net
  136. bind -a '#l1' /net
  137. echo 'bind ether outer 0 /net/ether0' >/net/bridge0/ctl
  138. echo 'bind ether inner 0 /net/ether1' >/net/bridge0/ctl
  139. .EE
  140. .SH "SEE ALSO"
  141. .IR ip (3)
  142. .SH SOURCE
  143. .B /sys/src/9/port/devbridge.c
  144. .SH BUGS
  145. Doesn't work with IPv6.