Score:1

How to check if ip forwarding is enabled

cl flag

i have 2 vps services from 2 diffrent providers and i want to use iptables for prerouting . i can do it easily on one but cant do it on the other one , i almost read all articles and tried them but nothing worked for me . any idea where to check? another thing there is a diffrence between two servers , the one which wont do ip forward , has an additional startup service call networking.service .

EDIT (from the comment, so we can read it): here are my iptables rules:

Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 to:158.58.185.249
DNAT all -- 0.0.0.0/0 0.0.0.0/0 to:91.107.191.135

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
David avatar
cn flag
What version or versions of Ubuntu are being used?
Doug Smythies avatar
gn flag
To check if ip forwarding is enabled do: `cat /proc/sys/net/ipv4/ip_forward`. Otherwise we need more information, such as your iptables rule set.
Pouria Sh avatar
cl flag
ubuntu version 20.04
ru flag
@PouriaSh did you check the output of `cat /proc/sys/net/ipv4/ip_forward` yet? That will determine if forwarding is enabled at the network card level and kernel level, and is a requisite for actual NAT to function
Pouria Sh avatar
cl flag
@ThomasWard yes ive checked and its enabled . i also put sysctl net.ipv4.ip_forward=1 on my first line on iptables service . i'll be glad if anyone can check my server personally .
ru flag
@PouriaSh when adding content that is comman dline and multline, add it as an edit to your post in the future please.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.