Linux : Disable and enable IPv4 forwarding
A quick note on how to disable or enable IP (version 4) forwarding in Linux. IP forwarding is a routing process used to determine which path a packet or datagram can be sent. If you are using Linux as a web server and you do not want your web server to be used in this routing process. You can disable the IP forwarding.
There are couple of ways you can disable IP forwarding.
In /etc/sysctl.conf
file, change net.ipv4.ip_forward = 0
or issue this command :
>sudo sysctl -w net.ipv4.ip_forward=0
to check if the IP forwarding has been disabled, you can view the /proc/sys/net/ipv4/ip_forward
file content. If it is 0
that means IP forwarding has been disabled.
In case you want to reverse your action, you can enable IP forwarding back with this command.
>sudo sysctl -w net.ipv4.ip_forward=1
Reference :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+9.2k Golang : does not implement flag.Value (missing Set method)
+6.6k Golang : Warp text string by number of characters or runes example
+47.8k Golang : Convert int to byte array([]byte)
+6.7k Golang : Output or print out JSON stream/encoded data
+6.4k PHP : Proper way to get UTF-8 character or string length
+11.1k Golang : Simple image viewer with Go-GTK
+15.7k Golang : Get checkbox or extract multipart form data value example
+7.3k Golang : File system scanning
+10.2k Golang : Text file editor (accept input from screen and save to file)
+9.7k Golang : Find correlation coefficient example
+19.2k Golang : Execute shell command
+8.9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?