Changes

Jump to: navigation, search

XUELK-TN-001: Configuring SBC Lynx as industrial router

1,222 bytes added, 16:14, 3 November 2020
no edit summary
{{InfoBoxTop}}
{{AppliesToAXELULite}}
{{AppliesToAXEL ULite TN}}
{{AppliesToSBCLynx}}
{{InfoBoxBottom}}
|August 2016
|First public release
|-
|{{oldid|5301|1.1.0}}
|August 2016
|Added section about persistent rules
|-
|1.1.1
|August 2016
|Added sysctl persistent settings
|-
|1.1.2
|May 2017
|Fix sysctl parameter
|-
|}
 
==Introduction==
Thanks to the dual Ethernet interface, SBC Lynx allows to implement non-trivial network configurations. As an example of this flexibility, this article shows how to configure SBC Lynx to implement a Linux-powered router that manages data packet forwarding between two different LANs. This task can be performed in parallel with the other application-specific activities (typically field bus communications, monitoring, control etc.). This solution allows to reduce significantly overall infrastructure costs in many industrial environments where Ethernet networking is popular nowadays.
Before proceeding on port forwarding rules setting, the forwarding capability must be enabled on both <code>eth0</code> and <code>eth1</code> interfaces:
<pre>
root@sbc-lynx:~# sysctl -w net.ipv4.conf.eth0.forwarding=1
net.ipv4.conf.eth0.forwarding = 1
root@sbc-lynx:~# sysctl -w net.ipv4.conf.eth1.forwarding=1
net.ipv4.conf.eth1.forwarding = 1
</pre>
</pre>
===Init ScriptMake <code>iptables</code> configuration persistent===<code>Iptablesiptables</code> init script is used to make <code>iptables</code> rules persistent and in order to load them automatically loading them at on boot.
The init script must be saved in the XUELK rfs target's root file system as <code>/etc/init.d/iptables</code>. From SBC Lynx the followings following commands can be used to create and edit the file:
<pre>
root@sbc-lynx:~# touch /etc/init.d/iptables
</pre>
Now at At the next boot the saved <code>iptables</code> rules will be automatically loaded.  ---- Please note that <code>sysctl</code> settings (e.g. the ones used to enable packet forwarding) are not persistent across reboots. To apply sysctl settings at boot time automatically loaded, just add them to [http://linux.die.net/man/5/sysctl.conf <code>/etc/sysctl.conf</code>] as <code>token = value</code>: <pre>root@sbc-lynx:~# tail /etc/sysctl.conf#net.ipv6.conf.all.accept_source_route = 0## Log Martian Packets#net.ipv4.conf.all.log_martians = 1# #kernel.shmmax = 141762560 net.ipv4.conf.eth0.forwarding=1net.ipv4.conf.eth1.forwarding=1</pre> sysctl.conf settings are applied with init script during network configuration (see <code>/etc/init.d/networking</code>) To check sysctl.conf syntax user can apply those settings also manually with the following command: <pre>root@sbc-lynx:~# sysctl -p /etc/sysctl.confnet.ipv4.conf.default.rp_filter = 1net.ipv4.conf.all.rp_filter = 1net.ipv4.conf.eth0.forwarding = 1net.ipv4.conf.eth1.forwarding = 1</pre>
8,154
edits

Navigation menu