A Linux kernel module for Network Address Translation (NAT)
- Supports Source NAT (SNAT) and Destination NAT (DNAT)
- Implements Port Address Translation (PAT)
- Handles TCP, UDP and ICMP packet translation
Complie the module
makeClean build
make cleanLoad the module
sudo insmod NAT.koUnload the module
sudo rmmod NATThe module leverages procfs(Process Filesystem) to provide runtime configuration without reloading the kernel module
cat /proc/NAT/ip
cat /proc/NAT/timeout
cat /proc/NAT/startSet WAN IP
echo "xxx.xxx.x.xxx" | sudo tee /proc/NAT/ipAdjust connection timeout
echo "120" | sudo tee /proc/NAT/timeoutEnable NAT
echo "1" | sudo tee /proc/NAT/startDisable NAT
echo "0" | sudo tee /proc/NAT/start