Categories
CentOS 7 Operating Systems

How to enable ip forwarding on CentOS 7

I wanted to enable IP masquerading/forwarding on CentOS 7.5, but for some reason, the typical method was not working. My clients could connect, but no traffic was passing beyond the VPS, and on to the internet. I was pretty sure it was my firewall masquerade rule was acting up, but no. It ended up being the kernel routing that you typically set in /etc/sysctl.conf as

net.ipv4.ip_forward = 1 I also tried net.ipv4.conf.default.forwarding = 1

I ended up needing to use the new method, which was actually in the top comment section of the sysctl.conf file. Which refernces using /usr/lib/sysctl.d/50-default.conf
add this line to the bottom of that file: net.ipv4.ip_forward = 1

Reboot, problem solved, started routing traffic outside of the VM.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.