Jump to content

A real Newbie Question - Autorun at boot up


David A Lewis

Recommended Posts

Hi All,

I am hoping someone is able to assist me in what I am sure is a beginner question.

I have configured my pineapple nano to work with my openvpn server and to route all connected pineapple traffic via the VPN (thanks to the Hak5 video).

I have created a script (1.sh) that contain the following:

iptables -t nat -A POSTROUTING -s 172.16.42.0/24 -o tun0 -j MASQUERADE
iptables -A FORWARD -s 172.16.42.0/24 -o tun0 -j ACCEPT
iptables -A FORWARD -d 172.16.42.0/24 -m state –state ESTABLISHED,RELATED -i tun0 -j ACCEPT

This works fine.

Is there a way that I can get 1.sh to run on boot up?

Thanks

David

Link to comment
Share on other sites

Make sure the first line of your script reads:

#!/bin/sh /etc/rc.common

Copy your script to the /etc/init.d/ directory

Make sure the execute bit is on

chmod +x /etc/init.d/<your script>

Enable your script

/etc/init.d/<your script> enable

Your script should now have a symlink in /etc/rc.d/

ls -lh /etc/rc.d | grep <your script>

Confirm your init script is enabled:

/etc/init.d/<your script> enabled && echo on

If this command returns on, then you're all set. If this command doesn't return anything, then your script isn't enabled. Here you will find more information about booting http://wiki.openwrt.org/doc/techref/process.boot

  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...