Dynamic ip changeRSS

6 replies

Last post Jul 17, 2019 06:12 AM by Chris Becke

  • Dynamic ip change

    Jul 11, 2019 07:13 PM|vk1097|LINK

    Hi friends,
    I have a python based web app and I'm trying to deploy in iis. Its working perfectly.
    But in my office, ip address is getting changed dynamically everyday. So each time i need to set the correct ip in bindings.
    Is there a way to automatically set the ip address whenever it changes?

    Thanks.
  • Re: Dynamic ip change

    Jul 12, 2019 05:48 AM|Jalpa Panchal|LINK

    Hi,

    For dynamic IP you could use * or "all unassigned" in iis binding.

    or you can write a powershell script to get ip and add binding with site when it's changed.

    Regards,

    Jalpa

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Dynamic ip change

    Jul 12, 2019 06:42 PM|vk1097|LINK


    Thanks Jalpa. I will try this solution and Can u please elaborate on how to use powershell script to set the ip address in bindings?
  • Re: Dynamic ip change

    Jul 15, 2019 05:29 AM|Jalpa Panchal|LINK

    You can use below PowerShell command to set the binding in iis:

    Import-Module WebAdministration
    New-WebBinding -Name "site1" -IPAddress "*" -Port 80

    For more information you can refer below link:

    New-WebBinding

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Dynamic ip change

    Jul 16, 2019 07:05 PM|vk1097|LINK

    Thanks Jalpa for the info but still its not working.
    Actually in my office network, we have dynamic ip address which changes every day.
    So each day i need to select the correct ip address from bindings. Also for ip address, i have a host name which has been mapped to correct active ip in hosts file. So users can directly enter host name (www. Something. Com) rather than entering ip.
    Painful part is i need to change ip manually every day to get the website work.
    Is there any workaround for this manual stuff like selecting ip automatically in bindings once ip dynamically changed?
  • Re: Dynamic ip change

    Jul 17, 2019 01:38 AM|Jalpa Panchal|LINK

    You need to write a PowerShell script by your self to collect ip and bind it with the iis site and host file.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Dynamic ip change

    Jul 17, 2019 06:12 AM|Chris Becke|LINK

    If you are using host files so people can visit the site by name - or even DNS, then typically what you would do is configure your IIS server with potentially multiple sites:

    If you used AppCmd, because who has time to do stuff over and over again in a GUI, and powershell is the enemy of reason then you would setup the bindings for two sites like this.

    %windir%\system32\inetsrv\appcmd set site /site.name:mysite1 /+bindings.[protocol='http',bindingInformation='*:80:mysite1.example.com']
    %windir%\system32\inetsrv\appcmd set site /site.name:mysite2 /+bindings.[protocol='http',bindingInformation='*:80:mysite2.example.com']

    This would get two sites, listing on *ALL* IP addresses: instead IIS would look at the host header to determine the correct site to route requests to.