You can not re-direct so easily with sudo. There are several potential solutions, including tee.
You can re-direct to files you own as the user calling sudo, such as files in your home directory, but not system files.
Example
# it works when re-direction to a location / file the user has permission to access
ubuntu@ubuntu:~$sudo echo "it works" > ~/file
ubuntu@ubuntu:~$cat file
it works
# But NOT if you do not have permission to access the target
ubuntu@ubuntu:~$sudo echo "it works" > /root/file
-bash: /root/file: Permission denied
Option one
use sudo bash -c and quote the entire command
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
Option two
Use tee
echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward