IPTABLES VU+Duo2

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • IPTABLES VU+Duo2

      Hi!!!

      I have VTI image 9.0.1 on vu+ duo2.

      I've istalled iptbales

      and then i have this command to launch:

      iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o eth0 -j MASQUERADE

      it's ok, it works for what i need, but at reboot i do need to insert the command manually again, the question is: How can i execute this command line automatically at reboot.

      Thank you
    • Hi,

      what should work is to create a shell script in /etc/network/if-pre-up.d/ that executes your command - like (you could name it iptables.sh):

      Shell-Script

      1. #!/bin/sh
      2. iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o eth0 -j MASQUERADE

      Don't forget to chmod +x the file.

      Cheers, Robert
      Diskutiere nie mit einem Idioten. Er zieht dich auf sein Niveau runter und schlägt dich mit seiner Erfahrung.
    • rdamas schrieb:

      Hi,

      what should work is to create a shell script in /etc/network/if-pre-up.d/ that executes your command - like (you could name it iptables.sh):

      Shell-Script

      1. #!/bin/sh
      2. iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o eth0 -j MASQUERADE

      Don't forget to chmod +x the file.

      Cheers, Robert

      Robert first of all thank you for your fast answer.
      I am not very familiar with linux command .

      I've made in the direcorty /etc/network/if-pre-up.d/ a file named iptables.sh

      inserted what you suggest, saved id and gave 777 permission

      at reboot doesn't work.

      Surely i've done something wrong.
    • Hmm; does the following work for you, after you've manually executed the iptables command from your first post?

      Quellcode

      1. iptables-save > /etc/iptables.up.rules

      and change the script /etc/network/if-pre-up.d/iptables.sh to

      Shell-Script

      1. #!/bin/sh
      2. /usr/sbin/iptables-restore < /etc/iptables.up.rules
      3. echo "Installed iptables" > /tmp/installed-iptables.txt

      The last line creates a text file /tmp/installed-iptables.txt - if that file exists after the reboot, the script was executed. I wonder if it will be created on your system?
      Diskutiere nie mit einem Idioten. Er zieht dich auf sein Niveau runter und schlägt dich mit seiner Erfahrung.
    • Done

      It works only if i manually enter via telnet :

      #!/bin/sh
      /usr/sbin/iptables-restore < /etc/iptables.up.rules
      echo "Installed iptables" > /tmp/installed-iptables.txt

      looks like the file iptables.sh doesn't start at boot
    • I've solved in this way

      The vti image has a cron job manager

      in the directory of cron : /etc/cron/crontabs/

      in the file root, i've inserted:

      * * * * * iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o eth0 -j MASQUERADE

      I've done some reboot and all it's working automatically