A router connects different networks. Every interface lies in its own network and has its own address; this address is the default gateway of the devices in that network. For every packet the router decides by its routing table where it goes next (How routing works). It does not forward broadcasts: it separates broadcast domains.
Two interfaces of the same router may not be in the same network; leyoNET rejects that like a real device.
Command line
In the simulation, double-clicking the router opens the console. The commands follow the style of FRRouting and Cisco IOS, with abbreviations (conf t, int e0 or int eth 0, sh ip int br, wr), ? and Tab. Everything also works in the router's window, including saving (“Save configuration” on the General tab):
Router> enable
Router# configure terminal
Router(config)# interface eth0
Router(config-if)# ip address 192.168.1.1/24
Router(config-if)# exit
Router(config)# ip route 0.0.0.0/0 203.0.113.1
Router(config)# do show ip route
Router(config)# end
Router# copy running-config startup-config
running-config and startup-config: every change takes effect at once but only lives in the running configuration (show running-config). Only copy running-config startup-config (short write memory) saves it; show startup-config shows what is saved, erase startup-config deletes it. The console window shows at the top whether the configuration is saved, and reload warns about unsaved changes. Exercises can check that it was saved.
The complete command reference is in the documentation command line (in German).
How to do it in leyoNET
The same text as in the app’s help (F1 key).
Router
Connects different networks; each interface sits in a different one. The router uses its routing table (Routing) to decide where a packet goes.
Routers, firewalls and switches can be configured on the command line (modelled on Cisco IOS and FRRouting). Open it: double-click the device or “Command line” in its window. Everything you set in the CLI appears in the forms and vice versa.
Usage:Tab completes, ? shows the options, ↑/↓ recalls earlier commands (kept until reload, also when switching between design and simulation). Right-click pastes; several lines (e.g. a whole show running-config) run one after another. Abbreviations like conf t, int g0/0, sh ip ro work. A command of another level (e.g. interface vlan 10 while in router ospf) jumps there.
Modes:enable (privileged), configure terminal (configuration), interface …, vlan …, router ospf 1, ip dhcp pool …, ip access-list extended …; exit one level up, end all the way out.
`do`: run a show command from configuration mode without leaving it: do show ip interface brief, do ping 192.168.1.1, do write.
Examples: - Address: interface eth0 → ip address 192.168.1.1 255.255.255.0 → no shutdown - VLAN and access port: vlan 10 → name ENTWICKLUNG → interface port1 → switchport access vlan 10 - Trunk: interface port8 → switchport mode trunk → switchport trunk allowed vlan 10,20 - Router on a stick: interface eth0.10 → encapsulation dot1q 10 → ip address 192.168.10.1/24 - Layer 3 switch: ip routing → interface vlan 10 → ip address 192.168.10.1/24 → ip helper-address 192.168.20.200 - Static route: ip route 10.0.0.0 255.0.0.0 192.168.1.254 - OSPF: router ospf 1 → network 0.0.0.0 255.255.255.255 area 0 - DHCP pool: ip dhcp excluded-address 192.168.10.1 192.168.10.9 → ip dhcp pool VLAN10 → network 192.168.10.0 255.255.255.0 → default-router 192.168.10.1 - ACL: ip access-list extended GAST → permit tcp any host 192.168.1.80 eq 80 → interface port2 → ip access-group GAST in - Port channel: interface range port7 - 8 → channel-group 1 mode active - Checks: show running-config, show ip route, show vlan brief, show interfaces trunk, show ip ospf neighbor, show access-lists, show ip dhcp binding, show etherchannel summary
All commands: documentation docs/cli.md.
Saving:show running-config shows the running configuration. As on a real device, copy running-config startup-config (short write memory) saves it as startup-config; show startup-config shows the saved one. The header of the CLI window shows whether anything changed since the last save.
Loopback interfaces
A loopback is an interface without a cable that is always up. Usually it has a /32 address (e.g. 10.255.0.1/32).
Router ID: OSPF takes the highest loopback address, otherwise the highest interface address.
OSPF advertises a loopback as a host route (/32) and sends no hellos there.
Fixed management address: reachable as long as any path to the device exists.
Router, firewall and layer-3 switch; in the Addresses tab or on the command line: interface loopback0, ip address 10.255.0.1/32, no interface loopback0.
See an example
Static routes
Two routers, each knows the remote network through a static route.
«tracert» shows both routers as hops. Delete a route and try again: destination network unreachable.
In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.
Read on
How routing worksDefault gateway, routing table, longest prefix and administrative distance – and when to route statically, automatically or dynamically.
Static routingEntering routes by hand: destination network, mask and next hop, default route, outbound and return path and the most common mistakes.
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.
Layer 3 switchA switch that also routes: VLAN interfaces (SVIs) as gateways, routing between VLANs, DHCP relay, OSPF and VXLAN.