Solved Need som help to choose tun inteface

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

octopus

Very Senior Member
I'm strugeling with this and can't get it working. Is there som smart guy's have any suggestion?

I'm trying to choose different "tun" inteface to send my mail on. eg. route-up on "tun11" and route-pre-down on "tun13" (have both running)

But it seems only one tun interface is used (tun11).
This is only som code <snippets>

Thanks !!!

vpn=$1 (tun [1-5])
if echo "${script_type}" = "route-up" && echo "$vpn" | grep -oE "[3]"; then INFACE="tun13"; fi
if echo "${script_type}" = "route-pre-down" && echo "$vpn" | grep -oE "[3]"; then INFACE="tun11"; fi
send(){
case $1 in
mail)
/usr/sbin/curl -s -S -4 --interface "$INFACE" \
--url smtps://$SMTP:$PORT \
--ssl-reqd \
--mail-auth $USERNAME \
--user "$USERNAME:$PASSWORD" \
--mail-from $FROM_ADDRESS \
--mail-rcpt $TO_1 \
--upload-file /tmp/rc-mail.txt
RC=$?
;;
I know, maby in wrong thread.......
 

eibgrad

Very Senior Member
Code:
[ "${script_type}" == 'route-up'       ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun13'
[ "${script_type}" == 'route-pre-down' ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun11'
 
Last edited:

octopus

Very Senior Member
Code:
[ "${script_type}" == "route-up"       ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun13'
[ "${script_type}" == "route-pre-down" ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun11'
Thanks! I gon test later one, have to take some puse from this.
 

dave14305

Part of the Furniture
I don’t think it works the way you expect.
 

octopus

Very Senior Member
Code:
[ "${script_type}" == 'route-up'       ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun13'
[ "${script_type}" == 'route-pre-down' ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun11'
Thanks!!
This working just fine, I only needed to change "{$vpn}" just only one digit coming.
 

octopus

Very Senior Member
Code:
[ "${script_type}" == 'route-up'       ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun13'
[ "${script_type}" == 'route-pre-down' ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun11'
I have modified a little, working just fine now.
case "${vpn}" in
1)
[ "${script_type}" = "route-up" ] && INFACE='tun11'
[ "${script_type}" = "route-pre-down" ] && INFACE='tun13';;
2)
[ "${script_type}" = "route-up" ] && INFACE='tun12'
[ "${script_type}" = "route-pre-down" ] && INFACE='tun12';;
3)
[ "${script_type}" = "route-up" ] && INFACE='tun13'
[ "${script_type}" = "route-pre-down" ] && INFACE='tun11';;
4)
[ "${script_type}" = "route-up" ] && INFACE='tun14'
[ "${script_type}" = "route-pre-down" ] && INFACE='tun14';;
5)
[ "${script_type}" = "route-up" ] && INFACE='tun15'
[ "${script_type}" = "route-pre-down" ] && INFACE='tun15';;
esac
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top