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
+6.8k Golang : Sort words with first uppercase letter
+6.6k Setting $GOPATH environment variable for Unix/Linux and Windows
+6.4k Golang : Rename part of filename
+27.9k Golang : JQuery AJAX post data to server and send data back to client example
+3.6k Adding Skype actions such as call and chat into web page examples
+16.7k Golang : Convert IPv4 address to decimal number(base 10) or integer
+5.1k Golang : Scan forex opportunities by Bollinger bands
+5.6k Golang : How to setup a disk space used monitoring service with Telegram bot
+4.5k Clean up Visual Studio For Mac installation failed disk full problem
+24.6k Golang : missing Mercurial command
+32.7k Golang : convert(cast) bytes to string
+5.9k Golang : Decode XML data from RSS feed