In linux, ip forwarding is disabled by default in linux releases. This is a good practice, because most people do not use ip forwarding, but if we set up a linux route or vpn service, we need to enable this service. In the following ways, I will enable ip forwarding in linux. by default, ip forwarding is disabled in linux. This is a good practice, because most people do not use ip forwarding, but if we set up a linux route or vpn service, we need to enable this service. Below I will activate it in several ways. Check whether ip forwarding is enabled. we need to access the kernel ipv4.ip _ forward of sysctl to determine whether forwarding is enabled. Use sysctl: sysctl net. ipv4.ip _ forward net. ipv4.ip _ forward = 0 or check the file in/proc: cat/proc/sys/net/ipv4/ip_forward 0. as we can see, ipv4 forwarding is not enabled (the value is 0 ). through sysctl, we can enable ipv4 forwarding (without restarting): sysctl-w net. ipv4.ip _ forward = 1 or echo 1>/proc/sys/net/ipv4/ip_forward is a temporary setting. its effect will expire with the restart of the computer. In/etc/sysctl. conf setting parameters if you want ip forwarding to take effect permanently, modify/etc/sysctl. conf. here we can add a net. ipv4.ip _ forward = 1/etc/sysctl. conf: net. ipv4.ip _ forward = 1 if your ipv4 forwarding item has been set to 0, you only need to change it to 1. to make the change take effect, run the following command: sysctl-p/etc/sysctl. conf can take effect on the red hat series release by restarting the network service: service network restart, while the debian/ubuntu series release uses the following command:/etc/init. d/procps. sh restart
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