Apache require ip range





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















Is is possible to give a defined range with require ip?



I have tried online calculators with masks and CIDR but cannot seem to find the correct answer.



I would like for example to set the range at 192.168.0.20 to 192.168.0.189 (to allow acces to local static IP range but deny local DHCP range), is this possible?










share|improve this question























  • 192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

    – NGRhodes
    Nov 28 '14 at 12:55













  • I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

    – markjames
    Nov 28 '14 at 13:25


















1















Is is possible to give a defined range with require ip?



I have tried online calculators with masks and CIDR but cannot seem to find the correct answer.



I would like for example to set the range at 192.168.0.20 to 192.168.0.189 (to allow acces to local static IP range but deny local DHCP range), is this possible?










share|improve this question























  • 192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

    – NGRhodes
    Nov 28 '14 at 12:55













  • I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

    – markjames
    Nov 28 '14 at 13:25














1












1








1


1






Is is possible to give a defined range with require ip?



I have tried online calculators with masks and CIDR but cannot seem to find the correct answer.



I would like for example to set the range at 192.168.0.20 to 192.168.0.189 (to allow acces to local static IP range but deny local DHCP range), is this possible?










share|improve this question














Is is possible to give a defined range with require ip?



I have tried online calculators with masks and CIDR but cannot seem to find the correct answer.



I would like for example to set the range at 192.168.0.20 to 192.168.0.189 (to allow acces to local static IP range but deny local DHCP range), is this possible?







apache2 ip






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 28 '14 at 10:18









markjamesmarkjames

356




356













  • 192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

    – NGRhodes
    Nov 28 '14 at 12:55













  • I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

    – markjames
    Nov 28 '14 at 13:25



















  • 192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

    – NGRhodes
    Nov 28 '14 at 12:55













  • I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

    – markjames
    Nov 28 '14 at 13:25

















192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

– NGRhodes
Nov 28 '14 at 12:55







192.168.0.X are not valid IP addresses. Zero is use to say any IP in this range, so can only be followed by zeros. You could have 192.168.1.20 to 192.168.1.189 or 192.168.1.0 for example to define ranges

– NGRhodes
Nov 28 '14 at 12:55















I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

– markjames
Nov 28 '14 at 13:25





I'm even more confused now. I have several machines with static ip address, set between this range, 192.168.0.20, 192.168.0.21, 192.168.0.43, etc. Everything in terms of ip addresses, hosts, etc seems to work OK, am I missing something?

– markjames
Nov 28 '14 at 13:25










1 Answer
1






active

oldest

votes


















0














Reading Apache documentation, I did not find a way to give ip range to require ip directive, as you need.



So, you should list every ip address one per require ip directive.



Another possibility is to use SetEnvIf to define a variable if Remote_Addr matches you ip range:



 SetEnvIf Remote_Addr "^192.168.0.([2-9][0-9])$|^192.168.0.1([0-8][0-9])$" allowIp
Require env allowIp


I didn't test it and regex can be improved for sure, but I think that this can give you a direction.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f554241%2fapache-require-ip-range%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Reading Apache documentation, I did not find a way to give ip range to require ip directive, as you need.



    So, you should list every ip address one per require ip directive.



    Another possibility is to use SetEnvIf to define a variable if Remote_Addr matches you ip range:



     SetEnvIf Remote_Addr "^192.168.0.([2-9][0-9])$|^192.168.0.1([0-8][0-9])$" allowIp
    Require env allowIp


    I didn't test it and regex can be improved for sure, but I think that this can give you a direction.






    share|improve this answer




























      0














      Reading Apache documentation, I did not find a way to give ip range to require ip directive, as you need.



      So, you should list every ip address one per require ip directive.



      Another possibility is to use SetEnvIf to define a variable if Remote_Addr matches you ip range:



       SetEnvIf Remote_Addr "^192.168.0.([2-9][0-9])$|^192.168.0.1([0-8][0-9])$" allowIp
      Require env allowIp


      I didn't test it and regex can be improved for sure, but I think that this can give you a direction.






      share|improve this answer


























        0












        0








        0







        Reading Apache documentation, I did not find a way to give ip range to require ip directive, as you need.



        So, you should list every ip address one per require ip directive.



        Another possibility is to use SetEnvIf to define a variable if Remote_Addr matches you ip range:



         SetEnvIf Remote_Addr "^192.168.0.([2-9][0-9])$|^192.168.0.1([0-8][0-9])$" allowIp
        Require env allowIp


        I didn't test it and regex can be improved for sure, but I think that this can give you a direction.






        share|improve this answer













        Reading Apache documentation, I did not find a way to give ip range to require ip directive, as you need.



        So, you should list every ip address one per require ip directive.



        Another possibility is to use SetEnvIf to define a variable if Remote_Addr matches you ip range:



         SetEnvIf Remote_Addr "^192.168.0.([2-9][0-9])$|^192.168.0.1([0-8][0-9])$" allowIp
        Require env allowIp


        I didn't test it and regex can be improved for sure, but I think that this can give you a direction.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '14 at 21:38









        LetyLety

        5,00521730




        5,00521730






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f554241%2fapache-require-ip-range%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            數位音樂下載

            When can things happen in Etherscan, such as the picture below?

            格利澤436b