Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:network:dsa:dsa-mini-tutorial [2022/09/11 21:34] – richb-hanover | docs:guide-user:network:dsa:dsa-mini-tutorial [2023/10/19 02:58] – [Introduction] saudiqbal | ||
|---|---|---|---|
| Line 29: | Line 29: | ||
| //NOTE: This section is under heavy revision (mid-September 2022). Please refer to the **DSA Terminology** conversation on the OpenWrt-devel mailing list for the latest information. http:// | //NOTE: This section is under heavy revision (mid-September 2022). Please refer to the **DSA Terminology** conversation on the OpenWrt-devel mailing list for the latest information. http:// | ||
| - | DSA distinguishes between **interfaces** and **networks**. | + | <del>DSA distinguishes between **interfaces** and **networks**. |
| * **Interfaces** (sometimes called " | * **Interfaces** (sometimes called " | ||
| Line 39: | Line 39: | ||
| * // | * // | ||
| - | **Naming Conventions: | + | **Naming Conventions: |
| ===== OpenWrt and DSA ===== | ===== OpenWrt and DSA ===== | ||
| Line 243: | Line 243: | ||
| option netmask ' | option netmask ' | ||
| </ | </ | ||
| + | |||
| + | ==== 5. Firewall zones for VLANs ==== | ||
| + | |||
| + | Every interface should have a correctly configured firewall zone. | ||
| + | However, if you want to only use layer 2 and not layer 3 routing on a VLAN (only switching, no traffic between VLANs), you can set the interface as unmanaged (option proto ' | ||
| + | |||
| + | Keep in mind, that at least one interface should have an address (static or DHCP) in order to connect to the device for administrative purposes. That interface must be associated with a firewall zone (or rules) to accept input. | ||
| + | |||
| + | Example, where VLAN 1, 2 and 3 are only used for switching and VLAN 1 can be used to connect to the device: | ||
| + | |||
| + | config/ | ||
| + | < | ||
| + | config device ' | ||
| + | option name ' | ||
| + | option type ' | ||
| + | option macaddr ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan ' | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | </ | ||
| + | |||
| + | config/ | ||
| + | < | ||
| + | config defaults | ||
| + | option syn_flood ' | ||
| + | option input ' | ||
| + | option output ' | ||
| + | option forward ' | ||
| + | |||
| + | config zone | ||
| + | option name ' | ||
| + | option input ' | ||
| + | option output ' | ||
| + | option forward ' | ||
| + | list network ' | ||
| + | </ | ||
| + | |||
| + | ==== 6. Security Considerations with VLANs ==== | ||
| + | |||
| + | See [[https:// | ||
| + | |||
| + | * If using separated VLANs, it is often recommended not to use VLAN 1 for any data networks. This is because VLAN 1 is often hardcoded as a default on a lot of networking equipment and is therefore more often used in attacks and prone to accidental misconfiguration. | ||
| + | |||
| + | * It is also often recommended to change the native VLAN on all trunk ports to an unused VLAN ID to explicitly only allow tagged traffic on trunk ports. Note that some hardware doesn' | ||
| + | |||
| + | * Similarly, for added security any unused LAN ports can be also added (as u|*) to an unused VLAN ID. | ||
| + | |||
| + | As an example let's assume a setup where: | ||
| + | * VLANS 10, 20 and 30 are used for seperated VLANs without any layer 3 routing | ||
| + | * the ports lan1 and lan2 are trunked ports with all VLANs | ||
| + | * port lan3 is only for untagged VLAN 1 | ||
| + | * port lan4 is unused | ||
| + | * VLAN 90 is not used anywhere else and is only there for added security | ||
| + | |||
| + | < | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | | VLAN ID | Local | lan1 | lan2 | lan3 | lan4 | | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | | 10 | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | | 20 | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | | 30 | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | | 90 | ||
| + | +---------+-------+------+------+------+------+ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | config device ' | ||
| + | option name ' | ||
| + | option type ' | ||
| + | option macaddr ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan ' | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | |||
| + | config bridge-vlan | ||
| + | option device ' | ||
| + | option vlan ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | list ports ' | ||
| + | option local ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | |||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device ' | ||
| + | </ | ||
| + | |||
| + | Note: Because local is not checked for VLAN 90, OpenWrt won't even create a device for it and there should be no interface for it, unlike the other VLANs. | ||
| + | |||