The current NAT code looks for the kernel module `nft_chain_nat_ipv4`, in linux kernel 5.1, this module is merged into `nft_chain_nat`.
This was changed in 5.1-rc1, with this commit: https://github.com/torvalds/linux/commit/3bf195ae6037e310d693ff3313401cfaf1261b71
This change makes the nat module fail when trying to compile vyos on a 5.1+ kernel.
as a "hotfix" this can be manually changed by:
```diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py
index dd34dfd6..cffb91ba 100755
--- a/src/conf_mode/nat.py
+++ b/src/conf_mode/nat.py
@@ -33,7 +33,7 @@ from vyos import ConfigError
from vyos import airbag
airbag.enable()
-k_mod = ['nft_nat', 'nft_chain_nat_ipv4']
+k_mod = ['nft_nat', 'nft_chain_nat']
default_config_data = {
'deleted': False,```
But i would not consider this a good solution,
another alternative is to use something like:
```
from distutils.version import LooseVersion
import platform
if LooseVersion(platform.release()) > LooseVersion("5.1"):
k_mod = ['nft_nat', 'nft_chain_nat']
else:
k_mod = ['nft_nat', 'nft_chain_nat_ipv4']
```
But this code is by no means verified