2011-03-30 13:49:47 +00:00
|
|
|
.TH BRIDGE 3
|
|
|
|
.SH NAME
|
2017-12-17 19:51:41 +00:00
|
|
|
bridge \- IP Ethernet bridge
|
2011-03-30 13:49:47 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B bind -a #B\fIb\fP /net
|
|
|
|
|
|
|
|
.B /net/bridge\fIb\fP/ctl
|
|
|
|
.B /net/bridge\fIb\fP/cache
|
|
|
|
.B /net/bridge\fIb\fP/log
|
|
|
|
.B /net/bridge\fIb\fP/stats
|
|
|
|
.BI /net/bridge\fIb\fP/ n
|
|
|
|
.BI /net/bridge\fIb\fP/ n /ctl
|
|
|
|
.BI /net/bridge\fIb\fP/ n /local
|
|
|
|
.BI /net/bridge\fIb\fP/ n /status
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
|
|
|
.I bridge
|
2017-12-17 19:51:41 +00:00
|
|
|
device bridges packets amongst Ethernet interfaces.
|
2011-03-30 13:49:47 +00:00
|
|
|
The number
|
|
|
|
.I b
|
|
|
|
in the bind is optional and selects a particular bridge
|
|
|
|
(default 0).
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B /net/bridge0
|
|
|
|
directory contains
|
|
|
|
.BR ctl ,
|
|
|
|
.BR cache ,
|
|
|
|
.BR log ,
|
|
|
|
and
|
|
|
|
.B stats
|
|
|
|
files, and numbered subdirectories for each physical interface.
|
|
|
|
.PP
|
|
|
|
Opening the
|
|
|
|
.B ctl
|
|
|
|
file reserves an interface.
|
|
|
|
The file descriptor returned from the
|
|
|
|
.IR open (2)
|
|
|
|
will point to the control file,
|
|
|
|
.BR ctl ,
|
|
|
|
of the newly allocated interface.
|
|
|
|
Reading
|
|
|
|
.B ctl
|
|
|
|
returns a text string representing the number of the interface.
|
|
|
|
Writing
|
|
|
|
.B ctl
|
|
|
|
alters aspects of the interface.
|
|
|
|
The possible
|
|
|
|
.I ctl
|
|
|
|
messages are:
|
|
|
|
.TP
|
2022-02-16 22:38:03 +00:00
|
|
|
.BI "bind ether " "name ownhash path [pvid[#prio][,vlans...]]"
|
2011-03-30 13:49:47 +00:00
|
|
|
Treat the device mounted at
|
|
|
|
.I path
|
|
|
|
(e.g.,
|
|
|
|
.LR /net/ether0 )
|
2017-12-17 19:51:41 +00:00
|
|
|
as an Ethernet medium
|
2011-03-30 13:49:47 +00:00
|
|
|
and associate it with this bridge (forward its packets to the
|
|
|
|
other interfaces associated with this bridge).
|
|
|
|
.I Ownhash
|
|
|
|
is an `owner hash'.
|
2022-02-16 22:38:03 +00:00
|
|
|
The optional
|
|
|
|
.I [pvid[#prio][,vlans...]]
|
|
|
|
argument is explained in
|
|
|
|
.B vlan
|
|
|
|
command below.
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
2022-02-16 22:38:03 +00:00
|
|
|
.BI "bind tunnel " "name ownhash path path2 [pvid[#prio][,vlans...]]"
|
2011-03-30 13:49:47 +00:00
|
|
|
Treat the device mounted at
|
|
|
|
.I path
|
2017-12-17 19:51:41 +00:00
|
|
|
as a network tunnel carrying Ethernet packets,
|
2011-03-30 13:49:47 +00:00
|
|
|
the device mounted at
|
|
|
|
.I path2
|
2017-12-17 19:51:41 +00:00
|
|
|
as an Ethernet
|
2011-03-30 13:49:47 +00:00
|
|
|
and associate them with this bridge
|
|
|
|
(forward its packets to the
|
|
|
|
other interfaces associated with this bridge).
|
|
|
|
Read packets from the
|
|
|
|
.I path
|
|
|
|
interface and write them to the
|
|
|
|
.I path2
|
|
|
|
interface.
|
|
|
|
Such tunnels have an MTU of 1400 bytes.
|
|
|
|
.TP
|
2022-02-16 22:38:03 +00:00
|
|
|
.BI "vlan " "pvid[#prio][,vlans...] type name [ownhash]"
|
|
|
|
Change the 802.1Q VLAN configuration of a port identified by
|
|
|
|
.IR type ,
|
|
|
|
.I name
|
|
|
|
and
|
|
|
|
.I ownhash.
|
|
|
|
The
|
|
|
|
.I pvid
|
|
|
|
is the "Native" VLAN id associated with untagged packets
|
|
|
|
on a port.
|
|
|
|
Packets with a VLAN id of
|
|
|
|
.I pvid
|
|
|
|
will be send out untagged on the port.
|
|
|
|
Untagged packets received on the port will be tagged with the
|
|
|
|
.IR pvid .
|
|
|
|
When
|
|
|
|
.I pvid
|
|
|
|
was not specified in a
|
|
|
|
.B bind
|
|
|
|
command above,
|
|
|
|
ports default to a
|
|
|
|
.I pvid
|
|
|
|
of
|
|
|
|
.BR "1" .
|
|
|
|
The
|
|
|
|
.I pvid
|
|
|
|
can be specified as 0 when untagged packets should
|
|
|
|
be ignored on a port.
|
|
|
|
The optional
|
|
|
|
.I prio
|
|
|
|
argument specifies the default priority to assign to a
|
|
|
|
incoming untagged packet on the port between 0 (lowest,
|
|
|
|
default) and 7 (highest).
|
|
|
|
The
|
|
|
|
.I vlans...
|
|
|
|
argument specifies comma separated ranges of other
|
|
|
|
VLAN id's that the port is a member of (for trunk ports).
|
|
|
|
Membership means the port is accepting
|
|
|
|
tagged packets with VLAN id's listed here and
|
|
|
|
ignores VLAN id's not listed here. Once accepted,
|
|
|
|
packets are forwarded only to other ports that are
|
|
|
|
members of the same (accepted) VLAN id.
|
|
|
|
Unless
|
|
|
|
.I pvid
|
|
|
|
is
|
|
|
|
.BR "0" ,
|
|
|
|
a port is always a member of its own
|
|
|
|
.I pvid
|
|
|
|
VLAN id,
|
|
|
|
so it does not need to be listed twice.
|
|
|
|
.TP
|
|
|
|
.BI "unbind " "type name [ownhash]"
|
2011-03-30 13:49:47 +00:00
|
|
|
Disassociate the interface associated with
|
2022-02-16 22:38:03 +00:00
|
|
|
.I name
|
2011-03-30 13:49:47 +00:00
|
|
|
from this bridge.
|
|
|
|
.I Type
|
|
|
|
must be
|
|
|
|
.L ether
|
|
|
|
or
|
|
|
|
.LR tunnel .
|
|
|
|
.TP
|
|
|
|
.B cacheflush
|
2022-02-16 22:38:03 +00:00
|
|
|
Clear the cache of (destination MAC address, VLAN id, port) tuples.
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
|
|
|
.BI "delay " "delay0 delayn"
|
|
|
|
Set the
|
|
|
|
.I delay0
|
|
|
|
and
|
|
|
|
.I delayn
|
|
|
|
parameters.
|
|
|
|
.I delay0
|
|
|
|
is the constant microsecond delay per packet
|
|
|
|
and
|
|
|
|
.I delayn
|
|
|
|
is the microsecond delay per byte.
|
|
|
|
.TP
|
|
|
|
.BI "set " option
|
|
|
|
Set bridge
|
|
|
|
.IR option .
|
|
|
|
The only known option is
|
|
|
|
.LR tcpmss ,
|
|
|
|
which limits the TCP Maximum Segment Size of
|
2017-12-17 19:51:41 +00:00
|
|
|
TCP packets passing through to 1300 bytes.
|
2011-03-30 13:49:47 +00:00
|
|
|
.TP
|
|
|
|
.BI "clear " option
|
|
|
|
Clear bridge
|
|
|
|
.IR option .
|
|
|
|
.PP
|
|
|
|
Reading
|
|
|
|
.I stats
|
|
|
|
returns statistics about the bridge.
|
|
|
|
.PP
|
|
|
|
Reading the
|
|
|
|
.I log
|
|
|
|
file returns data from the bridge's log
|
|
|
|
and will block at end of file awaiting new data.
|
|
|
|
.PP
|
|
|
|
Reading the
|
|
|
|
.B cache
|
2022-02-16 22:38:03 +00:00
|
|
|
file prints the cache of (destination MAC address, VLAN id, port) tuples,
|
2011-03-30 13:49:47 +00:00
|
|
|
one entry per line.
|
|
|
|
The format is:
|
|
|
|
the destination MAC (e.g., Ethernet) address in hex,
|
2022-02-16 22:38:03 +00:00
|
|
|
VLAN id,
|
2011-03-30 13:49:47 +00:00
|
|
|
port number,
|
|
|
|
count of packets from this address,
|
|
|
|
count of packets to this address,
|
|
|
|
expiry time in seconds since the epoch,
|
|
|
|
and
|
|
|
|
.L e
|
|
|
|
for expired entries or
|
|
|
|
.L v
|
|
|
|
for valid entries.
|
|
|
|
.PP
|
|
|
|
In a connection subdirectory,
|
|
|
|
.B ctl
|
|
|
|
and
|
|
|
|
.B local
|
|
|
|
don't do anything,
|
|
|
|
but
|
|
|
|
.B status
|
|
|
|
returns a one-line status summary.
|
|
|
|
.SH EXAMPLES
|
|
|
|
Set up a network bridge between two Ethernets
|
|
|
|
.RL ( #l0
|
|
|
|
and
|
|
|
|
.LR #l1 ).
|
|
|
|
.IP
|
|
|
|
.EX
|
|
|
|
bind -a '#B' /net
|
|
|
|
bind -a '#l1' /net
|
|
|
|
echo 'bind ether outer 0 /net/ether0' >/net/bridge0/ctl
|
|
|
|
echo 'bind ether inner 0 /net/ether1' >/net/bridge0/ctl
|
|
|
|
.EE
|
2022-02-16 22:38:03 +00:00
|
|
|
.PP
|
|
|
|
Set up bridge1 with 3 access ports and a trunk port.
|
|
|
|
.IP
|
|
|
|
.EX
|
|
|
|
# create bridge1
|
|
|
|
bind -a '#B1' /net
|
|
|
|
|
|
|
|
# nic for trunk carrying only tagged vlans 10,20 and 30
|
|
|
|
bind -a '#l0' /net
|
|
|
|
echo 'bind ether trunk 0 /net/ether0 0,10,20,30' >/net/bridge1/ctl
|
|
|
|
|
|
|
|
# create virtual nics for access ports
|
|
|
|
bind -a '#l1:sink ea=001122334401' /net
|
|
|
|
bind -a '#l2:sink ea=001122334402' /net
|
|
|
|
bind -a '#l3:sink ea=001122334403' /net
|
|
|
|
echo 'bind ether port1 0 /net/ether1 10' >/net/bridge1/ctl
|
|
|
|
echo 'bind ether port2 0 /net/ether2 20' >/net/bridge1/ctl
|
|
|
|
echo 'bind ether port3 0 /net/ether3 30' >/net/bridge1/ctl
|
|
|
|
.EE
|
2011-03-30 13:49:47 +00:00
|
|
|
.SH "SEE ALSO"
|
2022-02-16 22:38:03 +00:00
|
|
|
.IR ip (3),
|
|
|
|
.IR ether (3)
|
2011-03-30 13:49:47 +00:00
|
|
|
.SH SOURCE
|
|
|
|
.B /sys/src/9/port/devbridge.c
|