Domnev1: Difference between revisions

From Teltonika Networks Wiki
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
<p style="color:red">The information in this page is updated in accordance with [https://wiki.teltonika-networks.com/view/FW_%26_SDK_Downloads'''00.07.03'''] firmware version.</p>
<p style="color:red">The information on this page is updated in accordance with the [https://wiki.teltonika-networks.com/view/FW_%26_SDK_Downloads'''00.07.09'''] firmware version .</p>


==Introduction==
==Introduction==
This article contains instructions on how to do UCI-based configuration for setting up RelayD with IPv4+IPv6 support.


==Tunnelbroker configuration==
This article contains step-by-step instructions on how to set up bidirectional communication between two serial RS232 devices over TCP/IP.
[http://tunnelbroker.net Tunnelbroker.net] is a website operated by Hurricane Electric, a leading provider of internet services and networking solutions. The website provides a service called Hurricane Electric IPv6 Tunnel Broker, which allows users to create an IPv6 tunnel between their network and Hurricane Electric's network. This allows users to connect their devices to the internet using the IPv6 protocol, even if their internet service provider (ISP) does not support IPv6.
 
===Login===
==Configuration overview & prerequisites==
----
Go to [http://tunnelbroker.net tunnelbroker.net] and log into your account. If you don't have a registered account then you will need to create one - click '''register'''.
[[File:Tunnelbroker login.png|border|center|class=tlt-border|1004x1004px]]


===IPv6 to IPv4 tunnel setup===
End devices are connected to separate RUT956 routers through RS232 connection, and client connects to the server through its Public IP address.
Setup IPv6 over IPv4, also known as 6in4 IPv6 transition mechanism
----


To create a new tunnel, click on '''create regular tunnel''' ('''1'''), then '''enter''' your '''public IP''' (it will light up green, if the tunnel can be created with this IP) ('''2'''), '''select''' the desired '''tunnel server''' ('''3''') and '''create tunnel''' ('''4''').
[[File:OverIP Client Server network topology.png|border|class=tlt-border|1005px]]


[[File:Create IPv6 Tunnel.png|border|center|class=tlt-border|854x854px]]
'''Prerequisites''':


After successful tunnel creation, you will be prompt to tunnel details window.
*Two devices with RS232 support
*Two end devices (PCs or RS232 devices able to send and receive data, here we will be using PCs with serial simulators)
*Over IP Server must have a SIM card with a Public Static or Public Dynamic IP address (more on IP address types here) to make remote access possible
{{Template:Networking_rutos_manual_basic_advanced_webui_disclaimer
| series = RUTX
}}


[[File:IPv6 Tunnel created.png|border|center|class=tlt-border|454x454px]]
==Over IP Server==


To create a a tunnel instance on your RUT router, '''navigate''' to '''example configurations''' ('''1''') and select '''OpenWRT Barrier Breaker''' ('''2'''). Copy and paste the following commands into your RUT CLI. Do not forget to '''replace''' '''YOUR_TUNNELBORKER_USERNAME''' and '''YOUR_TUNNELBROKER_PASSWORD''' with your '''TunnelBroker account username''' and '''password'''.
====Obtaining Public IP: Set an APN====
----
In this example we are using Public IPs, it also works with Private IPs if routers are in same LAN


[[File:Tunnel interface.png|border|center|class=tlt-border|554x554px]]
'''Note:''' If you have a Public IP address already, you can skip this step.


In the RUT1 CLI you can see that the new interface has been successfully created.
To set the APN, while in the router's WebUI, navigate to the '''Network → Mobile → General → Interface mob1s1a1 APN configuration''':


[[File:Tunnel RUT interface created.png|border|center|class=tlt-border|554x554px]]
[[File:Set APN PF.png|border|class=tlt-border|alt=]]


==Relayd configuration==
Once in the '''Interface mob1s1a1 APN configuration''' window, edit your mobile interface, find the '''APN''' field and enter you Internet Service Provider's APN:
Relay is a daemon (computer program that runs as a background process) used to relay and dynamically redirect incoming connections to a target host. Its main purpose in RUTxxx routers is to extend the wireless network. For example, when RUTxxx is in STA Wireless Station mode, it can be used to bridge WAN and LAN interfaces to create a larger Wireless network.
# '''Disable the Auto APN option'''
# Choose the correct '''APN''', which gives out a public IP address (for more information about that contact your Internet Service Provider)


This article provides an extensive configuration example of a basic Relay usage scenario with two RUTxxx devices.
[[File:Set APN PF APN selected.png|border|class=tlt-border]]
===Relayd installation===
----
Install relayd package if needed, skip this step on RUTX series devices or if you already installed it on your router
<pre>opkg update
opkg install relayd</pre>


===WiFi client configuration===
Additional notes on APN:
----
* '''NOTE 1''': don't use the exact APN value as seen in the example above as it will not work with your SIM card. APN depends on your Internet Service Provider (ISP), therefore, your ISP should provide you with their APN or, in many case, you can find your ISP's APN with an online search.
Add WiFi interface to make your router act as a WiFi client (connect to another AP)
* '''NOTE 2''': furthermore, it should be noted that not all SIM cards support this functionality. Static or Dynamic Public IP addresses (obtained through APN) are a paid service and setting any APN value for a SIM card that doesn't support this service will most likely result in losing your data connection. If this is the case, it can be fixed by simply deleting the APN, but it also means that remote access through mobile WAN IP will most likely not work on your SIM card.
* '''NOTE 3''': in some cases the SIM card doesn't require an APN in order to obtain a Public IP address. If that is the case for you, simply check what your router's mobile WAN IP address is - if it's already a Public IP address, then you don't need to set an APN. The easiest way to find what your mobile WAN IP address is to log in to the router's WebUI and check the '''MOB1S1A1''' widget in the '''Overview''' page:


<pre>uci add wireless wifi-iface
[[File:Where public IP.png|border|class=tlt-border]]
uci set wireless.@wifi-iface[-1]=wifi-iface</pre>


Add new WiFi interface to 2.4ghz device, can specify 'radio1' for 5ghz


<pre>uci set wireless.@wifi-iface[-1].device='radio0'
===Over IP Server RS232 configuration===
uci set wireless.@wifi-iface[-1].mode='sta'
----
uci set wireless.@wifi-iface[-1].network='wifi_wan'</pre>
Navigate to the Over IP tab by going to '''Services → Serial Utilities → Over IP''' . Insert desired name and select RS232. Make sure to '''enable the instance''' '''(1)''' and '''configure Serial port in accordance''' '''(2)''' to connected device, these should match on both routers to avoid miscommunication.


Change SSID here to an SSID that the router will be connecting to
[[File:OverIP Sever serial config.png|border|class=tlt-border]]


<pre>uci set wireless.@wifi-iface[-1].ssid='RUT1_SSID'</pre>


Change BSSID here to BSSID that the router will be connecting to (L2 address)
===Over IP Server configuration===
----
After applying RS232 configuration scroll down and configure Over IP Server:


<pre>uci set wireless.@wifi-iface[-1].bssid='RUT1_BSSID'</pre>
# Mode '''Server'''- the device waits for incoming connections.
# Select a desired protocol, '''TCP or UDP'''.
# '''TCP/UDP port''' - specify desired port.


Use appropriate encryption method, PSK2 = WPA2-PSK here
[[File:OverIP TCP server configuration port.png|border|class=tlt-border]]


<pre>uci set wireless.@wifi-iface[-1].encryption='psk2'</pre>


Change secret to appropriate one
===IP Filter===
----


<pre>uci set wireless.@wifi-iface[-1].key='SSID_PASSWORD'
Once finished the above configuration, add interfaces through which routers will be communicating, You can add IP address that will be allowed to connect or enter 0.0.0.0 to allow all connections coming through correct port.
uci set wireless.@wifi-iface[-1].disabled='0'
uci set wireless.@wifi-iface[-1].skip_inactivity_poll='0'
uci set wireless.@wifi-iface[-1].wifi_id='wifi1'</pre>


===IPv4 interface creation===
[[File:OverIP TPC Server IP filter.png|border|class=tlt-border]]
----
Create a new interface IPv4 for WiFi WAN.
<pre>uci set network.wifi_wan=interface
uci set network.wifi_wan.proto='dhcp'
uci set network.wifi_wan.metric='6'
uci set network.wifi_wan.disabled='0'
uci set network.wifi_wan.force_link='0'
uci set network.wifi_wan.broadcast='0'</pre>


Set mwan3 settings for new interface


<pre>uci set mwan3.wifi_wan=interface
==OverIP Client==
uci set mwan3.wifi_wan.enabled='0'
uci set mwan3.wifi_wan.interval='3'
uci set mwan3.wifi_wan.family='ipv4'
uci add mwan3 condition
uci set mwan3.@condition[-1].interface='wifi_wan'
uci set mwan3.@condition[-1].track_method='ping'
uci add_list mwan3.@condition[-1].track_ip='1.1.1.1'
uci add_list mwan3.@condition[-1].track_ip='8.8.8.8'
uci set mwan3.@condition[-1].reliability='1'
uci set mwan3.@condition[-1].count='1'
uci set mwan3.@condition[-1].timeout='2'
uci set mwan3.@condition[-1].down='3'
uci set mwan3.@condition[-1].up='3'
uci set mwan3.wifi_wan_member_mwan=member
uci set mwan3.wifi_wan_member_mwan.interface='wifi_wan'
uci set mwan3.wifi_wan_member_mwan.metric='1'
uci set mwan3.wifi_wan_member_balance=member
uci set mwan3.wifi_wan_member_balance.interface='wifi_wan'
uci set mwan3.wifi_wan_member_balance.weight='1'
uci add_list mwan3.mwan_default.use_member='wifi_wan_member_mwan'
uci add_list mwan3.balance_default.use_member='wifi_wan_member_balance'</pre>


===IPv6 interface creation===
===OverIP Server RS232 configuration===
----
----
Create a new IPv6 interface for WiFi WAN
Navigate to the OverIP tab by going to '''Services → Serial Utilities → OverIP''' . Insert desired name and select RS232. Make sure to '''enable the instance''' '''(1)''' and '''configure Serial port in accordance''' '''(2)''' to connected device, these should match on both routers to avoid miscommunication.
<pre>uci set network.wifi_wan6=interface
uci set network.wifi_wan6.proto='dhcpv6'
uci set network.wifi_wan6.metric='6'
uci set network.wifi_wan6.disabled='0'
uci set network.wifi_wan6.force_link='0'
uci set network.wifi_wan6.reqaddress='try'
uci set network.wifi_wan6.reqprefix='auto'
uci set network.wifi_wan6.device='@wifi_wan'</pre>


Set proper ipv6 settings for wifi_wan6 iface
[[File:OverIP Client serial config.png|border|class=tlt-border]]


<pre>uci set mwan3.wifi_wan6=interface
uci set mwan3.wifi_wan6.enabled='0'
uci set mwan3.wifi_wan6.interval='3'
uci set mwan3.wifi_wan6.family='ipv6'
uci add mwan3 condition
uci set mwan3.@condition[-1].interface='wifi_wan6'
uci set mwan3.@condition[-1].track_method='ping'
uci add_list mwan3.@condition[-1].track_ip='2606:4700:4700::1111'
uci add_list mwan3.@condition[-1].track_ip='2001:4860:4860::8888'
uci set mwan3.@condition[-1].reliability='1'
uci set mwan3.@condition[-1].count='1'
uci set mwan3.@condition[-1].timeout='2'
uci set mwan3.@condition[-1].down='3'
uci set mwan3.@condition[-1].up='3'
uci set mwan3.wifi_wan6_member_mwan=member
uci set mwan3.wifi_wan6_member_mwan.interface='wifi_wan6'
uci set mwan3.wifi_wan6_member_mwan.metric='1'
uci set mwan3.wifi_wan6_member_balance=member
uci set mwan3.wifi_wan6_member_balance.interface='wifi_wan6'
uci set mwan3.wifi_wan6_member_balance.weight='1'
uci add_list mwan3.mwan_default.use_member='wifi_wan6_member_mwan'
uci add_list mwan3.balance_default.use_member='wifi_wan6_member_balance'
uci set mwan3.default_rule_ipv6=rule
uci set mwan3.default_rule_ipv6.dest_ip='::/0'
uci set mwan3.default_rule_ipv6.use_policy='mwan_default'
uci set mwan3.default_rule_ipv6.family='ipv6'</pre>


===LAN interface configuration===
===OverIP Client configuration===
----
----
Configure a LAN interface accordingly.
After applying RS232 configuration scroll down and configure Over IP Server:
<pre>uci set network.lan_repeater=interface
uci set network.lan_repeater.proto='relay'
uci set network.lan_repeater.lan_mark='lan'
uci set network.lan_repeater.enabled='1'
uci set network.lan_repeater.network='lan wifi_wan'</pre>


Set DHCP settings for LAN interface (disable dhcp on LAN) and enable IPv6 relay on wifi_wan interface and
# Mode '''Client''' – the device initiates the connection.
# Select a desired protocol, '''TCP or UDP'''.
# '''Address''' is the Over IP Sever Public IP address.  '''Port''' is the port we have configured on the Over IP Server device.


<pre>uci set dhcp.lan.ignore='1'
[[File:OverIP TCP Client configuration IP port.png|border|class=tlt-border]]
uci set dhcp.lan.ra='relay'
uci set dhcp.lan.dhcpv6='relay'
uci set dhcp.lan.ndp='relay'</pre>


<pre>uci set dhcp.wifi_wan=dhcp
==Testing configuration==
uci set dhcp.wifi_wan.ra='relay'
uci set dhcp.wifi_wan.dhcpv6='relay'
uci set dhcp.wifi_wan.master='1'
uci set dhcp.wifi_wan.ndp='relay'</pre>
 
===Firewall configuration===
----
Set firewall zone, using WAN firewall zone for newly created WiFi WAN network interface.
<pre>uci set firewall.@zone[1].network='wan wan6 mob1s1a1 mob1s2a1 wifi_wan'</pre>
 
===Commit changes===
----
Save all the changes and restart the configuration
<pre>uci commit
reload_config</pre>


==Testing the setup==
If you followed configuration steps both end devices should be able to send and receive data. In this example we use Hercules program on both computers and open serial communication with routers. We are able to send and receive data through RS232.
If you've taken all of the steps described above, the configuration is done. But as with any other configuration, it is always wise to test the set up in order to make sure that it works properly.


[[File:Sujungta.png|border|center|class=tlt-border|1105x1105px]]
[[File:Over IP Client Server hercules test.png|border|class=tlt-border|1004px]]

Latest revision as of 20:49, 13 October 2024

The information on this page is updated in accordance with the 00.07.09 firmware version .

Introduction

This article contains step-by-step instructions on how to set up bidirectional communication between two serial RS232 devices over TCP/IP.

Configuration overview & prerequisites

End devices are connected to separate RUT956 routers through RS232 connection, and client connects to the server through its Public IP address.

Prerequisites:

  • Two devices with RS232 support
  • Two end devices (PCs or RS232 devices able to send and receive data, here we will be using PCs with serial simulators)
  • Over IP Server must have a SIM card with a Public Static or Public Dynamic IP address (more on IP address types here) to make remote access possible

If you're having trouble finding this page or some of the parameters described here on your device's WebUI, you should turn on "Advanced WebUI" mode. You can do that by clicking the "Advanced" button, located at the top of the WebUI.

Over IP Server

Obtaining Public IP: Set an APN


In this example we are using Public IPs, it also works with Private IPs if routers are in same LAN

Note: If you have a Public IP address already, you can skip this step.

To set the APN, while in the router's WebUI, navigate to the Network → Mobile → General → Interface mob1s1a1 APN configuration:

Once in the Interface mob1s1a1 APN configuration window, edit your mobile interface, find the APN field and enter you Internet Service Provider's APN:

  1. Disable the Auto APN option
  2. Choose the correct APN, which gives out a public IP address (for more information about that contact your Internet Service Provider)

Additional notes on APN:

  • NOTE 1: don't use the exact APN value as seen in the example above as it will not work with your SIM card. APN depends on your Internet Service Provider (ISP), therefore, your ISP should provide you with their APN or, in many case, you can find your ISP's APN with an online search.
  • NOTE 2: furthermore, it should be noted that not all SIM cards support this functionality. Static or Dynamic Public IP addresses (obtained through APN) are a paid service and setting any APN value for a SIM card that doesn't support this service will most likely result in losing your data connection. If this is the case, it can be fixed by simply deleting the APN, but it also means that remote access through mobile WAN IP will most likely not work on your SIM card.
  • NOTE 3: in some cases the SIM card doesn't require an APN in order to obtain a Public IP address. If that is the case for you, simply check what your router's mobile WAN IP address is - if it's already a Public IP address, then you don't need to set an APN. The easiest way to find what your mobile WAN IP address is to log in to the router's WebUI and check the MOB1S1A1 widget in the Overview page:


Over IP Server RS232 configuration


Navigate to the Over IP tab by going to Services → Serial Utilities → Over IP . Insert desired name and select RS232. Make sure to enable the instance (1) and configure Serial port in accordance (2) to connected device, these should match on both routers to avoid miscommunication.


Over IP Server configuration


After applying RS232 configuration scroll down and configure Over IP Server:

  1. Mode Server- the device waits for incoming connections.
  2. Select a desired protocol, TCP or UDP.
  3. TCP/UDP port - specify desired port.


IP Filter


Once finished the above configuration, add interfaces through which routers will be communicating, You can add IP address that will be allowed to connect or enter 0.0.0.0 to allow all connections coming through correct port.


OverIP Client

OverIP Server RS232 configuration


Navigate to the OverIP tab by going to Services → Serial Utilities → OverIP . Insert desired name and select RS232. Make sure to enable the instance (1) and configure Serial port in accordance (2) to connected device, these should match on both routers to avoid miscommunication.


OverIP Client configuration


After applying RS232 configuration scroll down and configure Over IP Server:

  1. Mode Client – the device initiates the connection.
  2. Select a desired protocol, TCP or UDP.
  3. Address is the Over IP Sever Public IP address. Port is the port we have configured on the Over IP Server device.

Testing configuration

If you followed configuration steps both end devices should be able to send and receive data. In this example we use Hercules program on both computers and open serial communication with routers. We are able to send and receive data through RS232.