Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Notes:
- # - "corpVPN" is the name of the "/interface ovpn-client" item which
- # "dials into" the corporate VPN server
- # - 10.0.0.4 and 10.0.0.5 are the internal DNS servers
- # - This works, but I ended up finding a cleaner way to do it.
- /system script add name=vpn-up source={
- :local ifName [/interface get $interface name]
- :if ( $ifName = "corpVPN" ) do={
- :log info "VPN UP setting corp DNS"
- /ip dhcp-client set 0 use-peer-dns=no
- /ip dns set servers=10.0.0.4,10.0.0.5
- }
- }
- /system script add name=vpn-down source={
- :local ifName [/interface get $interface name]
- :if ( $ifName = "corpVPN" ) do={
- :log info "VPN DOWN setting dynamic DNS"
- /ip dhcp-client set 0 use-peer-dns=yes
- /ip dns set servers=""
- }
- }
- /system script add name=rebooted source={
- :log info "REBOOTED setting dynamic DNS"
- /ip dhcp-client set 0 use-peer-dns=yes
- /ip dns set servers=""
- }
- /ppp profile set [find] on-up=vpn-up on-down=vpn-down
- /system scheduler add name=rebooted start-time=startup on-event=rebooted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement