What's new

OpenVPN /etc/openvpn/client1/vpnrouting.sh question

  • 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!

msalerno

New Around Here
I'm walking through the script and I can make sense of most of it, but i'm having a problem figuring out a few things. Mainly, it has to do with setting up the routing tables. I understand where it makes a copy of the table but i'm having a problem figuring out how it knows to delete the vpn routes from the main table. I can't figure out the variables or how they get populated. I tried copying the script to openvpn-event and adding a bunch of echo statement, but it doesn't seem to be getting called during route-up event.

Can someone help me decipher the line?

Thanks

Code:
# Delete existing VPN routes that were pushed by server on table main
NET_LIST=$(ip route show|awk '$2=="via" && $3==ENVIRON["route_vpn_gateway"] && $4=="dev" && $5==ENVIRON["dev"] {print $1}')
  for NET in $NET_LIST
  do  
  ip route del $NET dev $dev  
  logger -t "openvpn-routing" "Removing route for $NET to $dev from routing tables"
  done
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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