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
+22.3k Golang : Generate MD5 checksum of a file
+4.4k Golang : Generate Interleaved 2 inch by 5 inch barcode
+9.8k Golang : Read until certain character to break for loop
+8.2k Golang : Read file with ioutil
+19.2k PHP : Convert(cast) int to double/float
+4.7k Fix yum-complete-transaction error
+6.9k Golang : Get final or effective URL with Request.URL example
+6.3k Golang : Create zip/ePub file without compression(use Store algorithm)
+18.4k Golang : How to get time from unix nano example
+8.1k Golang : Create unique title slugs example
+5.8k Golang : constant 20013 overflows byte error message
+5.3k Golang : Convert an executable file into []byte example