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
+10.4k Golang : Detect number of faces or vehicles in a photo
+18.8k Unmarshal/Load CSV record into struct in Go
+14.6k Android Studio : Use image as AlertDialog title with custom layout example
+8.9k Android Studio : Image button and button example
+15.5k Golang : Find location by IP address and display with Google Map
+26.5k Golang : Convert(cast) string to uint8 type and back to string
+10.3k Golang : How to profile or log time spend on execution?
+7.8k Golang : Test if an input is an Armstrong number example
+10.7k Golang : How to delete element(data) from map ?
+9.7k Golang : How to extract video or image files from html source code
+33.7k Golang : How to check if slice or array is empty?
+6.2k Golang : Grab news article text and use NLP to get each paragraph's sentences