Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux_router:nftables [2024-06-16 Sun wk24 12:03] – [Router Configuration] baumkp | linux_router:nftables [2025-03-02 Sun wk09 15:31] (current) – [NFTables Configuration] baumkp | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
=====NFTables Configuration===== | =====NFTables Configuration===== | ||
- | ====Router Configuration==== | + | The best reference for nftables is at the dedicated wiki [[https:// |
- | A router performs the following key features: | + | |
- | - A gateway between different network areas | + | |
- | - Restrict network traffic | + | |
- | - Forward Network traffic | + | |
- | - Track network traffic, allows traffic incoming only if response to out going (one way traffic) This is primary firewall action and primary security action! This is often confused with NAT, NAT is additional to this! | + | |
- | - NAT (Network Address Translation) is basically mandatory for IPv4 due to limited address space and optional for IPv6 | + | |
- | - NAT obfuscates Local IP addresses behind public addressable WAN IP address(es). | + | |
- | - NAT obfuscation wrecks simple end to end IP addressing that is required for some services, e.g. VoIP. This requires additional services to compensate, e.g. STUN/TURN services. | + | |
- | Key networks services, such as DNS and DHCP are separate functions that a router may perform, although correct router setup is required to allow these services to function. | + | |
- | + | ||
- | The best reference for nftables is at the dedicated wiki [[https:// | + | |
After a lot of experimenting the following is my NFTables router configuration file. Create the following file called: " | After a lot of experimenting the following is my NFTables router configuration file. Create the following file called: " | ||
Line 20: | Line 9: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | Also make permanent in ''/ | ||
+ | ====iptables==== | ||
+ | It is not a good idea to have both iptables and nftables rules setup at the same time. | ||
+ | *To check existing iptables rules: '' | ||
+ | <code text>-P INPUT ACCEPT | ||
+ | -P FORWARD ACCEPT | ||
+ | -P OUTPUT ACCEPT</ | ||
+ | *The iptables rules can be flushed with '' | ||
+ | |||
====Sample NFTables configuration==== | ====Sample NFTables configuration==== | ||
Line 296: | Line 294: | ||
Some key related commands: | Some key related commands: | ||
- | *To load a nft configuration file: '' | + | *To load a nft configuration file: '' |
+ | *Another option is to restart the nftables systemd service, '' | ||
+ | *To test the configuration after modification '' | ||
*The nftables configuration file can be made into an executable script as follows. | *The nftables configuration file can be made into an executable script as follows. | ||
*Add the following at the top of the file: | *Add the following at the top of the file: |