Greetings anutforajaroftuna,
One way to do what you are describing would be to use different network locations. This is set in System Preferences > Network at the top where it says Location:. You probably have one labeled Automatic that has one set of settings. You can create a new location from that menu by selecting Edit Locations and then clicking the "+" button. Name it something descriptive, then click Done. Set the various settings for Wi-Fi in this location the way you want them. Don't forget to change the DNS settings.
When you go to a place where you use one configuration, you just need to open network preferences - you can do this from the Wi-Fi menu - and then select the appropriate location and click the Apply button.
See this article for an overview of this process -
OS X Yosemite: Change your network settings
Thanks for using Apple Support Communities.
Be well,
Brett L