> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexwash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# r-TC Network

> How to connect FlexWash to an r-TC controller

First we'll define some terms.

## Local Area Network (LAN)

A sub network aka subnet, this is a set of devices connected locally to a router
wired and wirelessly.

A LAN has the following properties

* a prefix that all IP addresses in the LAN share e.g. `172.162.184.<host-id>`
* each device has a local IP address based on the subnet prefix
* a router that defines network parameters and communication between devices and external networks

We create a LAN using the coordinator at each car wash. The devices on this network include

* coordinator (there is a router service inside it)
* wired peripherals (RFID reader, r-TC, LPR cameras)
* wireless peripherals (pay terminals)

## Wide Area Network (WAN)

This is how multiple LANs can be connected. Think of it as a LAN for LANs.

Since the r-TC has it's own LAN this is how we bridge the two.

## r-TC \<> FlexWash WAN

We use a WAN when connecting our network to the r-TC network. We plug a CAT6
cable from our switch to the WAN port on the r-TC router.

<img src="https://mintcdn.com/flexwash/-skJ5Zr0XS2IRjgo/technical/controllers/rtc-network/rtc-router.png?fit=max&auto=format&n=-skJ5Zr0XS2IRjgo&q=85&s=5edccd64007eafc676300beb166eab6d" alt="rtc-router" width="1152" height="1173" data-path="technical/controllers/rtc-network/rtc-router.png" />

After connecting our LAN to the WAN port we need setup the WAN parameters in the
r-TC router.

You’ll need to login in the r-TC router (IP address in printed on the router
usually 192.168.1.91) and the username/password is usually admin/admin or
admin/password.

This is what sample WAN parameters look like at a functioning site.
172.162.184.60 is the IP address we assign for the `Wireless MAC address` in our
subnet. You should be able to ping this static IP address from our network.

<img src="https://mintcdn.com/flexwash/-skJ5Zr0XS2IRjgo/technical/controllers/rtc-network/rtc-router-home.png?fit=max&auto=format&n=-skJ5Zr0XS2IRjgo&q=85&s=eb8230ab3286ccda897147594fb557bb" alt="rtc-router" width="1152" height="1123" data-path="technical/controllers/rtc-network/rtc-router-home.png" />

<img src="https://mintcdn.com/flexwash/-skJ5Zr0XS2IRjgo/technical/controllers/rtc-network/rtc-wan.png?fit=max&auto=format&n=-skJ5Zr0XS2IRjgo&q=85&s=72244e110389a0e0a66159913a48f8d8" alt="rtc-router" width="1152" height="1066" data-path="technical/controllers/rtc-network/rtc-wan.png" />

We also use port forwarding so traffic from our network to a particular port is
sent from our coordinator to a particular device (the XML API server) in the r-TC
LAN. Note in the example below the service name is Washify because this site was
previously on Washify, this name is just a label it can be ignored.

Also important to have HTTP Server traffic forwarding on port 80, this allows us
to access the Kesseltronics web interface from our network.

<img src="https://mintcdn.com/flexwash/-skJ5Zr0XS2IRjgo/technical/controllers/rtc-network/rtc-port-forwarding.png?fit=max&auto=format&n=-skJ5Zr0XS2IRjgo&q=85&s=0774942368ca09599479de2a8c3806b7" alt="rtc-router" width="1152" height="1081" data-path="technical/controllers/rtc-network/rtc-port-forwarding.png" />

You can use the r-TC router’s network tools to verify traffic from the r-TC LAN
can reach our LAN

<img src="https://mintcdn.com/flexwash/-skJ5Zr0XS2IRjgo/technical/controllers/rtc-network/rtc-network-tools.png?fit=max&auto=format&n=-skJ5Zr0XS2IRjgo&q=85&s=dc454e8156bb2ef0dc109c50d8a2817e" alt="rtc-router" width="1152" height="1099" data-path="technical/controllers/rtc-network/rtc-network-tools.png" />
