Setup from scratch
Step-by-step terminal setup of four devices for the same task: a main ISP with a static address and DNS on port 1, an extra ISP on port 2 for access to specific resources, routes to those resources via the second link for hosts 192.168.3.1–192.168.3.254 only, three VLANs and a trunk on port 4. The initial data is the same for all devices — only the syntax differs.
Connection diagram
Initial data
| Parameter | Value |
|---|---|
| Port 1 — ISP1 | 203.0.113.10/29, gateway 203.0.113.9, DNS 203.0.113.2 and 203.0.113.3 |
| Port 2 — ISP2 | 198.51.100.10/29, gateway 198.51.100.9 (no default route via ISP2) |
| Resources via ISP2 | 192.0.2.10/32 and 192.0.2.128/25 (example) |
| Who reaches them via ISP2 | only 192.168.3.1–192.168.3.254; everyone else via ISP1 |
| VLAN 1 — port 3, untagged on the trunk | 192.168.0.0/22 (255.255.252.0), gateway 192.168.1.254; DHCP 192.168.0.1–192.168.0.254; manual 192.168.1.1–192.168.3.254 |
| VLAN 2 | 192.168.4.0/22, gateway 192.168.5.254, DHCP 192.168.4.1–192.168.4.254 |
| VLAN 3 | 192.168.8.0/22, gateway 192.168.9.254, DHCP 192.168.8.1–192.168.8.254 |
| Port 4 — TRUNK | VLAN 1 untagged (native), VLANs 2 and 3 tagged |
The ISP and resource addresses in the examples are documentation addresses (RFC 5737): 203.0.113.0/24, 198.51.100.0/24, 192.0.2.0/24. Replace them with your own. Replace passwords shown as <PASSWORD> with your own.
What was clarified in the original scheme
- “192.168.0.0–192.168.0.254, gateway 192.168.1.254” does not work with a /24 mask: the gateway must be in the same network as the hosts. With mask 255.255.252.0 (/22) the network is 192.168.0.0–192.168.3.255 and gateway 192.168.1.254 is inside it. That is how it is configured: DHCP hands out 192.168.0.1–192.168.0.254, and 192.168.1.1–192.168.3.254 are assigned manually.
- 192.168.0.0 is the network address and cannot be given to a device; the first host address is 192.168.0.1. The last address, 192.168.3.255, is the broadcast address.
- 192.168.1.254 lies in the manual range but is taken by the gateway — do not assign it to devices.
- The task did not specify gateways for VLAN 2 and VLAN 3; by analogy with VLAN 1, 192.168.5.254 and 192.168.9.254 are used.
- VLAN 1 is the default VLAN: all unconfigured ports and switch control traffic end up in it. The scheme follows the task, but in a production network it is better to give users e.g. VLAN 10.
- The Eltex MES3308F is a switch and cannot do NAT, so the ISPs are connected to it through edge routers.
- The Cisco ASA 5505 does not support PBR (its last software release is 9.2, PBR arrived in 9.4); the task is solved with NAT divert and requires the Security Plus license.
- The ISP and resource addresses are documentation addresses (RFC 5737); replace them with real ones.
Devices
Zyxel ZyWALL USG 300ZLD firewall: a bridge for VLAN 1, a policy route with SNAT to ISP2.
MikroTik RB2011UiAS-2HnDRouterOS v7: bridge VLAN filtering, routing table isp2 and mangle.
Eltex MES3308FL3 switch without NAT: network core, transit to the ISP routers, PBR via route-map.
Cisco ASA 5505No PBR: link choice via twice NAT (NAT divert), Security Plus license.
Common check after setup
- Host 192.168.3.10 (mask 255.255.252.0, gateway 192.168.1.254): a traceroute to 192.0.2.10 goes via ISP2 (on the Eltex via 10.0.2.1).
- Host 192.168.1.10: a traceroute to 192.0.2.10 goes via ISP1, and the internet works.
- A DHCP client in VLAN 2 gets 192.168.4.x with gateway 192.168.5.254 and reaches the internet.
- A device in VLAN 3 behind the switch on the trunk port gets 192.168.8.x; an untagged device on the same switch gets a VLAN 1 address.
Before entering commands, save the device's current configuration and work through the console port: network access is lost while port roles change.