xref: /freebsd/sbin/etherswitchcfg/etherswitchcfg.8 (revision 29fc4075e69fd27de0cded313ac6000165d99f8b)
1.\" Copyright (c) 2011-2012 Stefan Bethke.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd June 23, 2021
28.Dt ETHERSWITCHCFG 8
29.Os
30.Sh NAME
31.Nm etherswitchcfg
32.Nd configure a built-in Ethernet switch
33.Sh SYNOPSIS
34.Nm
35.Op Fl "f control file"
36.Cm info
37.Nm
38.Op Fl "f control file"
39.Cm config
40.Ar command parameter
41.Nm
42.Op Fl "f control file"
43.Cm phy
44.Ar phy.register[=value]
45.Nm
46.Op Fl "f control file"
47.Cm port%d
48.Ar [flags] command parameter
49.Nm
50.Op Fl "f control file"
51.Cm reg
52.Ar register[=value]
53.Nm
54.Op Fl "f control file"
55.Cm vlangroup%d
56.Ar command parameter
57.Sh DESCRIPTION
58The
59.Nm
60utility is used to configure an Ethernet switch built into the system.
61.Nm
62accepts a number of options:
63.Pp
64.Bl -tag -width ".Fl f" -compact
65.It Fl "f control file"
66Specifies the
67.Xr etherswitch 4
68control file that represents the switch to be configured.
69It defaults to
70.Pa /dev/etherswitch0 .
71.It Fl m
72When reporting port information, also list available media options for
73that port.
74.It Fl v
75Produce more verbose output.
76Without this flag, lines that represent inactive or empty configuration
77options are omitted.
78.El
79.Ss config
80The config command provides access to global switch configuration
81parameters.
82It support the following commands:
83.Pp
84.Bl -tag -width ".Cm vlan_mode mode" -compact
85.It Cm vlan_mode Ar mode
86Sets the switch VLAN mode (depends on the hardware).
87.El
88.Ss phy
89The phy command provides access to the registers of the PHYs attached
90to or integrated into the switch controller.
91PHY registers are specified as phy.register,
92where
93.Ar phy
94is usually the port number, and
95.Ar register
96is the register number.
97Both can be provided as decimal, octal or hexadecimal numbers in any of the formats
98understood by
99.Xr strtol 3 .
100To set the register value, use the form instance.register=value.
101.Ss port
102The port command selects one of the ports of the switch.
103It supports the following commands:
104.Pp
105.Bl -tag -width ".Ar pvid number" -compact
106.It Cm pvid Ar number
107Sets the default port VID that is used to process incoming frames that are not tagged.
108.It Cm media Ar mediaspec
109Specifies the physical media configuration to be configured for a port.
110.It Cm mediaopt Ar mediaoption
111Specifies a list of media options for a port.
112See
113.Xr ifconfig 8
114for details on
115.Cm media
116and
117.Cm mediaopt .
118.It Cm led Ar number style
119Sets the display style for a given LED.
120Available styles are:
121.Cm default
122(usually flash on activity),
123.Cm on ,
124.Cm off ,
125and
126.Cm blink .
127Not all switches will support all styles.
128.El
129.Pp
130And the following flags (please note that not all flags
131are supported by all switch drivers):
132.Pp
133.Bl -tag -width ".Fl addtag" -compact
134.It Cm addtag
135Add VLAN tag to each packet sent by the port.
136.It Fl addtag
137Disable the add VLAN tag option.
138.It Cm striptag
139Strip the VLAN tags from the packets sent by the port.
140.It Fl striptag
141Disable the strip VLAN tag option.
142.It Cm striptagingress
143Strip the VLAN tags from the packets received by the port.
144.It Fl striptagingress
145Disable the strip VLAN tag on ingress option.
146.It Cm firstlock
147This options makes the switch port lock on the first MAC address it sees.
148After that, usually you need to reset the switch to learn different
149MAC addresses.
150.It Fl firstlock
151Disable the first lock option.
152Note that sometimes you need to reset the
153switch to really disable this option.
154.It Cm droptagged
155Drop packets with a VLAN tag.
156.It Fl droptagged
157Disable the drop tagged packets option.
158.It Cm dropuntagged
159Drop packets without a VLAN tag.
160.It Fl dropuntagged
161Disable the drop untagged packets option.
162.It Cm doubletag
163Enable QinQ for the port.
164.It Fl doubletag
165Disable QinQ for the port.
166.It Cm ingress
167Enable the ingress filter on the port.
168.It Fl ingress
169Disable the ingress filter.
170.El
171.Ss reg
172The reg command provides access to the registers of the switch controller.
173.Ss vlangroup
174The vlangroup command selects one of the VLAN groups for configuration.
175It supports the following commands:
176.Pp
177.Bl -tag -width ".Cm members" -compact
178.It Cm vlan Ar VID
179Sets the VLAN ID (802.1q VID) for this VLAN group.
180Frames transmitted on tagged member ports of this group will be tagged
181with this VID.
182Incoming frames carrying this tag will be forwarded according to the
183configuration of this VLAN group.
184.It Cm members Ar port,...
185Configures which ports are to be a member of this VLAN group.
186The port numbers are given as a comma-separated list.
187Each port can optionally be followed by
188.Dq t
189to indicate that frames on this port are tagged.
190.El
191.Sh FILES
192.Bl -tag -width /dev/etherswitch? -compact
193.It Pa /dev/etherswitch?
194Control file for the Ethernet switch driver.
195.El
196.Sh EXAMPLES
197Configure VLAN group 1 with a VID of 2 and make ports 0 and 5 its members
198while excluding all other ports.
199Port 5 will send and receive tagged frames while port 0 will be untagged.
200Incoming untagged frames on port 0 are assigned to vlangroup1.
201.Pp
202.Dl # etherswitchcfg vlangroup1 vlan 2 members 0,5t port0 pvid 2
203.Sh SEE ALSO
204.Xr etherswitch 4
205.Sh HISTORY
206.Nm
207first appeared in
208.Fx 10.0 .
209.Sh AUTHORS
210.An Stefan Bethke
211