This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d549333511 script: enable forward in simhostroute.sh
d549333511 is described below

commit d5493335114065e97a3bba31378bc3194cf3166b
Author: Zhe Weng <[email protected]>
AuthorDate: Tue Dec 13 16:08:24 2022 +0800

    script: enable forward in simhostroute.sh
    
    We found that some people don't know / forget to enable forward in linux, 
which keeps nat not working.
    
    Because we don't know the previous state before 'on', and forward seldom 
has side effect, we don't disable it in 'off'.
    
    Signed-off-by: Zhe Weng <[email protected]>
---
 tools/simhostroute.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/simhostroute.sh b/tools/simhostroute.sh
index 53a012e9b2..1ab55c07a6 100755
--- a/tools/simhostroute.sh
+++ b/tools/simhostroute.sh
@@ -62,6 +62,9 @@ if [ "$STATUS" == "on" ]; then
     iptables -A FORWARD -i $IF_HOST -o $IF_BRIDGE -m state --state 
RELATED,ESTABLISHED -j ACCEPT
     iptables -A FORWARD -i $IF_BRIDGE -o $IF_HOST -j ACCEPT
 
+    # enable forward to make sure nat works
+    sysctl -w net.ipv4.ip_forward=1
+
     ip route show
 else
     ip route delete $IP_NET

Reply via email to