Configure packet forwarding in Linux

Source: Internet
Author: User
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
     

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.