What's new

Solved Need som help to choose tun inteface

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

octopus

Part of the Furniture
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.......
 
Code:
[ "${script_type}" == 'route-up'       ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun13'
[ "${script_type}" == 'route-pre-down' ] && [ "${vpn:4:1}" == '3' ] && INFACE='tun11'
 
Last edited:
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.
 
I don’t think it works the way you expect.
 
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.
 
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
 

Latest threads

Sign Up For SNBForums Daily Digest

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