Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH BRIDGE 3
2
.SH NAME
3
bridge \- Ethernet bridge and IPv4 tunnel
4
.SH SYNOPSIS
5
.nf
6
.B bind -a #B\fIb\fP /net
7
.sp 0.4v
8
.B /net/bridge\fIb\fP/ctl
9
.B /net/bridge\fIb\fP/cache
10
.B /net/bridge\fIb\fP/log
11
.B /net/bridge\fIb\fP/stats
12
.BI /net/bridge\fIb\fP/ n
13
.BI /net/bridge\fIb\fP/ n /ctl
14
.BI /net/bridge\fIb\fP/ n /local
15
.BI /net/bridge\fIb\fP/ n /status
16
.fi
17
.SH DESCRIPTION
18
The
19
.I bridge
20
device bridges (copies) packets 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
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 (of IPv4 in IPv4),
71
the device mounted at
72
.I path2
73
as an Ethernet medium
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
Such tunnels have an MTU of 1400 bytes.
83
.TP
84
.BI "unbind " "type address [ownhash]"
85
Disassociate the interface associated with
86
.I address
87
from this bridge.
88
.I Type
89
must be
90
.L ether
91
or
92
.LR tunnel .
93
.TP
94
.B cacheflush
95
Clear the cache of (destination MAC address, port) tuples.
96
.TP
97
.BI "delay " "delay0 delayn"
98
Set the
99
.I delay0
100
and
101
.I delayn
102
parameters.
103
.I delay0
104
is the constant microsecond delay per packet
105
and
106
.I delayn
107
is the microsecond delay per byte.
108
.TP
109
.BI "set " option
110
Set bridge
111
.IR option .
112
The only known option is
113
.LR tcpmss ,
114
which limits the TCP Maximum Segment Size of
115
TCP packets passing through to 1300 bytes.
116
.TP
117
.BI "clear " option
118
Clear bridge
119
.IR option .
120
.PP
121
Reading
122
.I stats
123
returns statistics about the bridge.
124
.PP
125
Reading the
126
.I log
127
file returns data from the bridge's log
128
and will block at end of file awaiting new data.
129
.PP
130
Reading the
131
.B cache
132
file prints the cache of (destination MAC address, port) tuples,
133
one entry per line.
134
The format is:
135
the destination MAC (e.g., Ethernet) address in hex,
136
port number,
137
count of packets from this address,
138
count of packets to this address,
139
expiry time in seconds since the epoch,
140
and
141
.L e
142
for expired entries or
143
.L v
144
for valid entries.
145
.PP
146
In a connection subdirectory,
147
.B ctl
148
and
149
.B local
150
don't do anything,
151
but
152
.B status
153
returns a one-line status summary.
154
.SH EXAMPLES
155
Set up a network bridge between two Ethernets
156
.RL ( #l0
157
and
158
.LR #l1 ).
159
.IP
160
.EX
161
bind -a '#B' /net
162
bind -a '#l1' /net
163
echo 'bind ether outer 0 /net/ether0' >/net/bridge0/ctl
164
echo 'bind ether inner 0 /net/ether1' >/net/bridge0/ctl
165
.EE
166
.SH "SEE ALSO"
167
.IR ip (3)
168
.SH SOURCE
169
.B /sys/src/9/port/devbridge.c
170
.SH BUGS
171
Understands but won't tunnel nor fragment IPv6.