Temporary Method: change the parameters of the following files directly in the kernel space: # files in echo1/proc/sys/net/ipv4/ip_forwardproc cannot be modified using vi, the file can only be modified in echo mode. once changed, the file takes effect immediately. However, if the system is restarted, the permanent method will be returned to the default setting: Change/etc/sysct. conf file [root @ dem Temporary Method: change the parameters of the following files directly in the kernel space:
# Echo 1>/proc/sys/net/ipv4/ip_forward
|
Files in proc cannot be modified using vi, but can only be modified using echo.
This file takes effect immediately after it is changed.
However, if you restart the system, the system will return to the default settings.
Permanent method: change the/etc/sysct. conf file.
[Root @ demo1 mac] # vi/etc/sysctl. conf # Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled.Seesysctl (8) and # Sysctl. conf (5) for more details. # Controls IP packet forwarding Net. ipv4.ip _ forward = 1
|
After modification, it must be restarted./etc/init. d/network restart cannot be used.
Found after restarting
[Root @ demo1 mac] # cat/proc/sys/net/ipv4/ip_forward
1 Change forwarding in two places
/Proc/sys/net/ipv4/ip_forward Most common
Used to enable forwarding for individual interfaces
/Proc/sys/net/ipv4/conf/all/forwarding
/Proc/sys/net/ipv4/conf/eth0/forwarding
/Proc/sys/net/ipv4/conf/eth1/forwarding