* Correct syntax for dnat in inet table?
[not found] <6D405016-FCB8-44C5-86CF-EE18A9F75839@plutonium24.de>
@ 2020-08-05 16:04 ` Frank-Ulrich Sommer
2020-08-06 11:27 ` kfm
2020-08-06 18:17 ` Florian Westphal
0 siblings, 2 replies; 3+ messages in thread
From: Frank-Ulrich Sommer @ 2020-08-05 16:04 UTC (permalink / raw)
To: netfilter
Hello,
I'm using "nftables v0.9.0 (Fearless Fosdick)" on a Debian Buster based Raspberry Pi OS.
I'm getting syntax errors when trying to redirect a port to another host via nftables.conf with the two lines starting with "iif eth0.100". The file does not contain a complete setup because I removed all rules not related to the problem.
The first line produces "nftables.conf:10:41-42: Error: syntax error, unexpected to, expecting newline or semicolon". According to the manpage I would have expected the correct syntax for an inet table to be "...dnat ip to..."
The second line without "to" produces "nftables.conf:11:56-56: Error: syntax error, unexpected newline".
What would be the correct syntax if I want e.g. to forward traffic to port 1234 to IPv4 123.123.123.123 in an inet table?
Here is the reduced nftables.conf causing these errors:
#!/usr/sbin/nft -f
flush ruleset
table inet myfilter {
chain port_forwarding {
type nat hook prerouting priority 0; policy accept;
iif eth0.100 tcp dport 1234 dnat ip to 123.123.123.123
iif eth0.100 tcp dport 2345 dnat ip 123.123.123.123
}
}
Kind regards
Frank
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Correct syntax for dnat in inet table?
2020-08-05 16:04 ` Correct syntax for dnat in inet table? Frank-Ulrich Sommer
@ 2020-08-06 11:27 ` kfm
2020-08-06 18:17 ` Florian Westphal
1 sibling, 0 replies; 3+ messages in thread
From: kfm @ 2020-08-06 11:27 UTC (permalink / raw)
To: Frank-Ulrich Sommer, netfilter
On 05/08/2020 17:04, Frank-Ulrich Sommer wrote:
>
>
> Hello,
>
> I'm using "nftables v0.9.0 (Fearless Fosdick)" on a Debian Buster based Raspberry Pi OS.
>
> I'm getting syntax errors when trying to redirect a port to another host via nftables.conf with the two lines starting with "iif eth0.100". The file does not contain a complete setup because I removed all rules not related to the problem.
>
> The first line produces "nftables.conf:10:41-42: Error: syntax error, unexpected to, expecting newline or semicolon". According to the manpage I would have expected the correct syntax for an inet table to be "...dnat ip to..."
>
> The second line without "to" produces "nftables.conf:11:56-56: Error: syntax error, unexpected newline".
Both error messages are of poor quality.
>
> What would be the correct syntax if I want e.g. to forward traffic to port 1234 to IPv4 123.123.123.123 in an inet table?
>
> Here is the reduced nftables.conf causing these errors:
>
> #!/usr/sbin/nft -f
>
> flush ruleset
>
> table inet myfilter {
>
> chain port_forwarding {
> type nat hook prerouting priority 0; policy accept;
>
> iif eth0.100 tcp dport 1234 dnat ip to 123.123.123.123
"eth0.100" isn't a valid iface_index. Use iifname instead.
--
Kerin Millar
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Correct syntax for dnat in inet table?
2020-08-05 16:04 ` Correct syntax for dnat in inet table? Frank-Ulrich Sommer
2020-08-06 11:27 ` kfm
@ 2020-08-06 18:17 ` Florian Westphal
1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2020-08-06 18:17 UTC (permalink / raw)
To: Frank-Ulrich Sommer; +Cc: netfilter
Frank-Ulrich Sommer <orofuhin@gmail.com> wrote:
> I'm using "nftables v0.9.0 (Fearless Fosdick)" on a Debian Buster based Raspberry Pi OS.
>
> I'm getting syntax errors when trying to redirect a port to another host via nftables.conf with the two lines starting with "iif eth0.100". The file does not contain a complete setup because I removed all rules not related to the problem.
>
> The first line produces "nftables.conf:10:41-42: Error: syntax error, unexpected to, expecting newline or semicolon". According to the manpage I would have expected the correct syntax for an inet table to be "...dnat ip to..."
>
> The second line without "to" produces "nftables.conf:11:56-56: Error: syntax error, unexpected newline".
>
> What would be the correct syntax if I want e.g. to forward traffic to port 1234 to IPv4 123.123.123.123 in an inet table?
>
> Here is the reduced nftables.conf causing these errors:
>
> #!/usr/sbin/nft -f
>
> flush ruleset
>
> table inet myfilter {
>
> chain port_forwarding {
> type nat hook prerouting priority 0; policy accept;
>
> iif eth0.100 tcp dport 1234 dnat ip to 123.123.123.123
> iif eth0.100 tcp dport 2345 dnat ip 123.123.123.123
> }
> }
nft list ruleset
table inet myfilter {
chain port_forwarding {
type nat hook prerouting priority filter; policy accept;
iif "lo" tcp dport 1234 dnat ip to 123.123.123.123
}
}
nft --version
nftables v0.9.5 (Capital Idea)
(I had to use different interface name because iif requires the name to exist
when parsing).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-06 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <6D405016-FCB8-44C5-86CF-EE18A9F75839@plutonium24.de>
2020-08-05 16:04 ` Correct syntax for dnat in inet table? Frank-Ulrich Sommer
2020-08-06 11:27 ` kfm
2020-08-06 18:17 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox