Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # script to automatically set DNS information on connection
- mv -v /etc/resolv.conf /etc/resolv.conf.hold # back up old file
- for OPTION in ${!foreign_option_*} ;
- do
- [ -z "${!OPTION}" ] && break
- if [ -n "$(echo ${!OPTION} | egrep -e '^dhcp-option (DOMAIN|DNS)')" ]; then
- echo ${!OPTION} | sed \
- -e 's/dhcp-option DOMAIN/search/g' \
- -e 's/dhcp-option DNS/nameserver/g' \
- >> /etc/resolv.conf
- fi
- done
- if [ ! -f /etc/resolv.conf ]; then # openvpn did not set any DNS information
- mv -v /etc/resolv.conf.hold /etc/resolv.conf
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement