A firewall sits between networks with different levels of trust: the internet, the internal network and a DMZ for servers that should be reachable from outside. It routes like a Router but only lets through what a rule allows.
Zones
Interface
Zone
out of the box
eth0
WAN (internet)
new connections from here forbidden
eth1
LAN (internal)
may go out
eth2
DMZ (public servers)
may go out
eth3 …
OPT (further)
may go out
The firewall is stateful: replies to allowed connections come back without a rule of their own. A web server in the DMZ needs a rule like “allow TCP 80 to the web server, incoming on WAN”, usually together with port forwarding (NAT and PAT). Unlike a router, its rules also protect itself: from the WAN it answers neither ping nor SSH out of the box.
Reading rules
Rules apply from top to bottom, the first match decides, the default rule comes last. In the simulation every rule counts its hits, and the console reports blocked packets. Firewall rules (packet filter) explains how rules are built.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
Firewall
A firewall as a device of its own: it routes like a router but filters out of the box. The ports are named after their zone:
eth0 (WAN): to the internet or provider
eth1 (LAN): internal network
eth2 (DMZ): servers that should be reachable from outside
eth3 … (OPT): further zones
Out of the box: stateful, LAN, DMZ and OPT may go out, everything else is denied. Replies come back, new connections from the WAN need a rule of their own, e.g. «Allow TCP 80 to the web server, incoming on WAN». Unlike a router it uses the same rules to protect itself: out of the box it answers neither ping nor SSH from the WAN (packets from its own VPN peers are exempt).
Configure it in the Firewall tab or on the command line (firewall rule allow tcp any 192.168.2.80 port 80 in wan, show firewall). Besides that it can do everything a router can: NAT/PAT, Port forwarding, VPN (IPsec), static and dynamic routes. See Firewall.
See an example
Firewall device and ACL
A dedicated firewall separates WAN, LAN and DMZ; an access list on the switch port lets guests reach only the web server.
«Aussen» opens the web server in the DMZ (allowed) and pings the office PC (firewall blocks). Then the guest notebook pings the office PC (ACL drops) and opens the web server (allowed). Filter «tcp.port == 80 or icmp».
“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.
Practise
★★★☆☆Firewall: securing a DMZ· 4 goals · Worksheet (German)
★★★☆☆Guest port with access list· 3 goals · Worksheet (German)
In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.
Read on
Firewall rules (packet filter)Rules from top to bottom, default rule, stateful or stateless – how a router or firewall decides what may pass.
NAT and PATBringing private networks to the internet: port address translation (PAT), port forwarding, static SNAT and DNAT, 1:1 NAT and CGNAT at the provider.
Access control lists (ACL)Named lists with permit and deny on a switch port or VLAN interface: stateless, first match applies, implicit deny at the end.