Destination NAT for netmap. Validation error

I was trying to create a Destination NAT with a NETMAP where two equal sized networks are NAT’ed… It doesn’t seem to work. It’s a new feature after nftables was adopted.

vyos@vyos# commit
[ nat ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):

When reporting problems, please include as much information as possible:

  • do not obfuscate any data (feel free to contact us privately if your
    business policy requires it)
  • and include all the information presented below

Report Time: 2021-02-11 16:58:43
Image Version: VyOS 1.4-rolling-202102100753
Release Train: sagitta

Built by:
Built on: Wed 10 Feb 2021 07:54 UTC
Build UUID: b99c3240-c9a7-4f01-ac6c-c1d2e4748c2b
Build Commit ID: aec60effa4e36e

Architecture: x86_64
Boot via: installed image
System type: KVM guest

Hardware vendor: QEMU
Hardware model: Standard PC (Q35 + ICH9, 2009)
Hardware S/N:
Hardware UUID: 02d26e80-76c2-41d3-902c-0cf0f99280fc

Traceback (most recent call last):
File “/usr/libexec/vyos/conf_mode/”, line 201, in
File “/usr/libexec/vyos/conf_mode/”, line 186, in generate
File “/usr/lib/python3/dist-packages/vyos/”, line 112, in render
rendered = render_to_string(template, content, formater)
File “/usr/lib/python3/dist-packages/vyos/”, line 82, in render_to_string
rendered = template.render(content)
File “/usr/lib/python3/dist-packages/jinja2/”, line 76, in render
return original_render(self, *args, **kwargs)
File “/usr/lib/python3/dist-packages/jinja2/”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/usr/lib/python3/dist-packages/jinja2/”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python3/dist-packages/jinja2/”, line 37, in reraise
raise value.with_traceback(tb)
File “/usr/share/vyos/templates/firewall/nftables-nat.tmpl”, line 148, in top-level template code
{{ nat_rule(rule, config, ‘PREROUTING’) }}
File “/usr/lib/python3/dist-packages/jinja2/”, line 579, in _invoke
rv = self._func(*arguments)
File “/usr/share/vyos/templates/firewall/nftables-nat.tmpl”, line 27, in template
{% set trns_addr = ‘dnat ip prefix to ip daddr map { ’ + config.source.address + ’ : ’ + config.translation.address + ’ }’ %}
File “/usr/lib/python3/dist-packages/jinja2/”, line 430, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘dict object’ has no attribute ‘source’

[[nat]] failed
Commit failed
vyos@vyos# compare
[edit nat]
+destination {

  • rule 100 {
  •    destination {
  •        address
  •    }
  •    inbound-interface wg01
  •    translation {
  •        address
  •    }
  • }

Hello @joolli. I see that the bug report already created and patch committed

1 Like