Difference between revisions of "Ip forward"
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | You might have noticed that /proc/sys/net/ipv4/ip_forward keeps getting reset to 0. | + | You might have noticed that /proc/sys/net/ipv4/ip_forward keeps getting reset to 0. |
− | /etc/network/options and change the line | + | |
+ | There are three places I've found that cause this to happen. First is /etc/network/options. Go | ||
+ | in there and change the line | ||
<pre>ip_forward=no | <pre>ip_forward=no | ||
</pre> to | </pre> to | ||
<pre> | <pre> | ||
ip_forward=yes | ip_forward=yes | ||
− | </pre> the problem | + | </pre> |
+ | |||
+ | Next is /etc/pmnetconfig/if-down. Comment out the lines | ||
+ | |||
+ | <pre> | ||
+ | ${LOG} "${ECHO} 0 >/proc/sys/net/ipv4/ip_forward" | ||
+ | ${ECHO} 0 >/proc/sys/net/ipv4/ip_forward | ||
+ | </pre> | ||
+ | |||
+ | Last and not least, is the binary /usr/bin/PmNetConfigManager. First, make a fake place for it to write to | ||
+ | |||
+ | <pre> | ||
+ | mount -o remount,rw / | ||
+ | mkdir-p /media/cryptofs/fake/sys/net/ipv4 | ||
+ | ln -s /media/cryptofs/fake /fake | ||
+ | echo 0 >/fake/sys/net/ipv4/ip_forward | ||
+ | mount -o remount,ro / | ||
+ | </pre> | ||
+ | |||
+ | Next, patch /usr/bin/PmNetConfigManager so it writes to /fake/sys/net/ipv4/ip_forward instead of /proc/sys/net/ipv4/ip_forward. Just open it up in a hex editor, find that path, and change "proc" to "fake". Make sure you only change those four bytes. You should probably also make sure you have a backup of the original binary. After you replace PmNetConfigManager, restart it. | ||
+ | |||
+ | <pre> | ||
+ | stop PmNetConfigManager | ||
+ | start PmNetConfigManager | ||
+ | </pre> | ||
+ | |||
+ | Another way to solve this problem is to make /proc/sys/net/ipv4/ip_forward innaccessable. As PuffTheMagic_ put it: | ||
+ | <pre> | ||
+ | <PuffTheMagic_> smoofra: mount -o bind /dev/null over ip_forward | ||
+ | <PuffTheMagic_> then mount proc in a new directory | ||
+ | <PuffTheMagic_> and set it to 1 from that new dir | ||
+ | <PuffTheMagic_> ;) | ||
+ | </pre> |
Latest revision as of 04:27, 2 March 2010
You might have noticed that /proc/sys/net/ipv4/ip_forward keeps getting reset to 0.
There are three places I've found that cause this to happen. First is /etc/network/options. Go in there and change the line
ip_forward=no
to
ip_forward=yes
Next is /etc/pmnetconfig/if-down. Comment out the lines
${LOG} "${ECHO} 0 >/proc/sys/net/ipv4/ip_forward" ${ECHO} 0 >/proc/sys/net/ipv4/ip_forward
Last and not least, is the binary /usr/bin/PmNetConfigManager. First, make a fake place for it to write to
mount -o remount,rw / mkdir-p /media/cryptofs/fake/sys/net/ipv4 ln -s /media/cryptofs/fake /fake echo 0 >/fake/sys/net/ipv4/ip_forward mount -o remount,ro /
Next, patch /usr/bin/PmNetConfigManager so it writes to /fake/sys/net/ipv4/ip_forward instead of /proc/sys/net/ipv4/ip_forward. Just open it up in a hex editor, find that path, and change "proc" to "fake". Make sure you only change those four bytes. You should probably also make sure you have a backup of the original binary. After you replace PmNetConfigManager, restart it.
stop PmNetConfigManager start PmNetConfigManager
Another way to solve this problem is to make /proc/sys/net/ipv4/ip_forward innaccessable. As PuffTheMagic_ put it:
<PuffTheMagic_> smoofra: mount -o bind /dev/null over ip_forward <PuffTheMagic_> then mount proc in a new directory <PuffTheMagic_> and set it to 1 from that new dir <PuffTheMagic_> ;)