Internet Connection Sharing: Difference between revisions
→Usage: Add missing nftable commands |
Add equivalent nftables configuration; use <code> instead of backticks. |
||
| Line 13: | Line 13: | ||
Here <code>eth0</code> is the ethernet interface connected to the internet, and <code>wlan0</code> is the wifi interface to share the internet connection with a wifi hotspot. However, these names may not be the same on your system. To check the name of your hardware interface use the command <code>ifconfig</code> or <code>ifconfig | grep ^[^:]*:</code> It will list network adapters on your system. Then modify command accordingly <code>sudo create_ap <wifiInterfaceName> <ethernetInterfaceName> MyAccessPoint <Password></code> | Here <code>eth0</code> is the ethernet interface connected to the internet, and <code>wlan0</code> is the wifi interface to share the internet connection with a wifi hotspot. However, these names may not be the same on your system. To check the name of your hardware interface use the command <code>ifconfig</code> or <code>ifconfig | grep ^[^:]*:</code> It will list network adapters on your system. Then modify command accordingly <code>sudo create_ap <wifiInterfaceName> <ethernetInterfaceName> MyAccessPoint <Password></code> | ||
=== Configuration === | === Configuration === | ||
| Line 67: | Line 63: | ||
=== Configuration === | === Configuration === | ||
Persistently share an existing internet connection on interface | Persistently share an existing internet connection on interface <code>wlan0</code> to clients connected on an ethernet interface <code>eth0</code>. Tested where <code>wlan0</code> is a wireless interface, but it should work with a different ethernet interface as well. You do not need to manually open port 53. | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 119: | Line 115: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | |||
For nftables, the equivalent of the iptables rules in <code>networking.firewall.extraCommands</code> above is the following. | |||
<syntaxhighlight lang="nix"> | |||
networking.nftables.ruleset = '' | |||
table ip nat { | |||
chain POSTROUTING { | |||
type nat hook postrouting priority 100; | |||
oifname "wlp2s0" counter masquerade | |||
} | |||
} | |||
table ip filter { | |||
chain INPUT { | |||
iifname "enp3s0" counter accept | |||
} | |||
} | |||
''; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Networking]] | [[Category:Networking]] | ||