@@ -7,14 +7,24 @@ IO boards, with HostMot2 firmware.
77
88== SYNOPSIS
99
10- *loadrt hm2_eth* [**config=**"__str__[,__str__...]"] [**board_ip=**__ip__[,__ip__...] ] [**board_mac=**__mac__[,__mac__...] ]
10+ *loadrt hm2_eth* [**config=**"__str__[,__str__...]"] [**board_ip=**__ip__[,__ip__...] ] [**board_mac=**__mac__[,__mac__...] ] [**no_iptables=**__0|1__]
1111
1212____
1313*config* [default: ""]::
1414 HostMot2 config strings, described in the hostmot2(9) manpage.
1515*board_ip* [default: ""]::
1616 The IP address of the board(s), separated by commas.
1717 As shipped, the board address is 192.168.1.121.
18+ *no_iptables* [default: 0]::
19+ Explicit override that disables all iptables interaction. By default
20+ hm2_eth installs *iptables* and *ip6tables* rules itself; rtapi_app
21+ raises *cap_net_admin* into its ambient capability set at startup so
22+ the calls succeed under both setuid-root and rootless (file-cap)
23+ installs. If the cap is not held the probe fails and rule
24+ installation is skipped with a warning; in that case configure the
25+ rules manually using the recipe in the NOTES section below. Set
26+ *no_iptables=1* when iptables is reachable but you prefer to manage
27+ the firewall externally (nftables, firewalld, systemd units).
1828____
1929
2030== DESCRIPTION
@@ -146,6 +156,53 @@ At (normal) exit, hm2_eth will remove the rules. After a crash, you can
146156manually clear the rules with *sudo iptables -F hm2-eth-rules-output*;
147157the rules are also removed by a reboot.
148158
159+ === Manual iptables configuration
160+
161+ When LinuxCNC is installed without *cap_net_admin* on rtapi_app
162+ (typically because *sudo make setcap* was not run after the build),
163+ hm2_eth cannot install its rules and prints a warning. Set up the
164+ chain manually as root. Adjust the IP addresses, UDP destination port,
165+ and interface name to match your install:
166+
167+ ----
168+ HOST_IP=192.168.1.1
169+ BOARD_IP=192.168.1.121
170+ BOARD_DPORT=27181
171+ IFACE=eth1
172+
173+ iptables -N hm2-eth-rules-output
174+ iptables -I OUTPUT 1 -j hm2-eth-rules-output
175+ iptables -A hm2-eth-rules-output \
176+ -p udp -m udp -d $BOARD_IP --dport $BOARD_DPORT \
177+ -s $HOST_IP -j ACCEPT
178+ iptables -A hm2-eth-rules-output -o $IFACE -p icmp -j DROP
179+ iptables -A hm2-eth-rules-output -o $IFACE \
180+ -j REJECT --reject-with icmp-admin-prohibited
181+ ip6tables -N hm2-eth-rules-output
182+ ip6tables -I OUTPUT 1 -j hm2-eth-rules-output
183+ ip6tables -A hm2-eth-rules-output -o $IFACE -j DROP
184+ ----
185+
186+ For full IPv6 quiescence (no router solicitations or neighbor discovery
187+ on the dedicated interface), additionally add this line to
188+ `/etc/sysctl.d/99-hm2-eth.conf` and reboot:
189+
190+ ----
191+ net.ipv6.conf.IFACE.disable_ipv6 = 1
192+ ----
193+
194+ (The default ip6tables rule above only drops outbound IPv6; the kernel
195+ still generates the packets.) Tear down the runtime rules with:
196+
197+ ----
198+ iptables -F hm2-eth-rules-output
199+ iptables -D OUTPUT -j hm2-eth-rules-output
200+ iptables -X hm2-eth-rules-output
201+ ip6tables -F hm2-eth-rules-output
202+ ip6tables -D OUTPUT -j hm2-eth-rules-output
203+ ip6tables -X hm2-eth-rules-output
204+ ----
205+
149206"hardware-irq-coalesce-rx-usecs" decreases time waiting to receive a packet on most systems,
150207but on at least some Marvel-chipset NICs it is harmful.
151208If the line does not improve system performance, then remove it.
0 commit comments