Enabling rp_filter loose (#2) mode for IPv6











up vote
0
down vote

favorite












does anyone have a solution to make reverse path filtering work (in loose mode) also for IPv6 and not only for IPv4?



The setup I am having is a machine1 connected directly to a machine2, while machine1 being also connected to outside net.



The targetted traffic is this:
Client (from the outside net) sends a request to the machine1 which then forwards the request to the machine2.



Obvious problem: When packet gets handled by machine1, it forwards it to a port connected to machine2, but with source IP of a client. This would normally be seen as a spoofed ip - but that's what rp_filter is for, right?



Normally on machine1 I would do (for IPv4):

echo 2 > /proc/sys/net/ipv4/conf/<interface_to_outside_net>/rp_filter

and everything would work, but for IPv6 this is not the case since rp_filter is not implemented in the kernel for IPv6 as of yet.
The only solution I know of would be to set up ip6tables.



Current settings:

ip6tables -t raw -N RPFILTER
ip6tables -t raw -A RPFILTER -m rpfilter -j RETURN
ip6tables -t raw -A RPFILTER -m rpfilter --loose -j ACCEPT
ip6tables -t raw -A PREROUTING -j RPFILTER



But for some reason traffic never reaches machine2 and on the client side I get timeout.



Using tcpdump on machine1 I get only the SYN of TCP handshake.:



14:18:50.390292 IP6 fd11:3456:789a:1::4.34184 > fd12:3456:789a:1::1.1111: Flags [S], seq 701159610, win 28800, options [mss 1440,sackOK,TS val 6066549 ecr 0,nop,wscale 7], length 0



nothing else...



Any advice?










share|improve this question






















  • What Linux distribution did you use? What kernel version? What firewall?
    – Michael Hampton
    Nov 26 at 15:54










  • OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
    – Diavel
    Nov 27 at 7:47










  • I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
    – Diavel
    Nov 27 at 12:05






  • 1




    Are you sure that machine1 is actually routing traffic?
    – Michael Hampton
    Nov 27 at 12:08










  • Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
    – Diavel
    Nov 27 at 12:42















up vote
0
down vote

favorite












does anyone have a solution to make reverse path filtering work (in loose mode) also for IPv6 and not only for IPv4?



The setup I am having is a machine1 connected directly to a machine2, while machine1 being also connected to outside net.



The targetted traffic is this:
Client (from the outside net) sends a request to the machine1 which then forwards the request to the machine2.



Obvious problem: When packet gets handled by machine1, it forwards it to a port connected to machine2, but with source IP of a client. This would normally be seen as a spoofed ip - but that's what rp_filter is for, right?



Normally on machine1 I would do (for IPv4):

echo 2 > /proc/sys/net/ipv4/conf/<interface_to_outside_net>/rp_filter

and everything would work, but for IPv6 this is not the case since rp_filter is not implemented in the kernel for IPv6 as of yet.
The only solution I know of would be to set up ip6tables.



Current settings:

ip6tables -t raw -N RPFILTER
ip6tables -t raw -A RPFILTER -m rpfilter -j RETURN
ip6tables -t raw -A RPFILTER -m rpfilter --loose -j ACCEPT
ip6tables -t raw -A PREROUTING -j RPFILTER



But for some reason traffic never reaches machine2 and on the client side I get timeout.



Using tcpdump on machine1 I get only the SYN of TCP handshake.:



14:18:50.390292 IP6 fd11:3456:789a:1::4.34184 > fd12:3456:789a:1::1.1111: Flags [S], seq 701159610, win 28800, options [mss 1440,sackOK,TS val 6066549 ecr 0,nop,wscale 7], length 0



nothing else...



Any advice?










share|improve this question






















  • What Linux distribution did you use? What kernel version? What firewall?
    – Michael Hampton
    Nov 26 at 15:54










  • OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
    – Diavel
    Nov 27 at 7:47










  • I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
    – Diavel
    Nov 27 at 12:05






  • 1




    Are you sure that machine1 is actually routing traffic?
    – Michael Hampton
    Nov 27 at 12:08










  • Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
    – Diavel
    Nov 27 at 12:42













up vote
0
down vote

favorite









up vote
0
down vote

favorite











does anyone have a solution to make reverse path filtering work (in loose mode) also for IPv6 and not only for IPv4?



The setup I am having is a machine1 connected directly to a machine2, while machine1 being also connected to outside net.



The targetted traffic is this:
Client (from the outside net) sends a request to the machine1 which then forwards the request to the machine2.



Obvious problem: When packet gets handled by machine1, it forwards it to a port connected to machine2, but with source IP of a client. This would normally be seen as a spoofed ip - but that's what rp_filter is for, right?



Normally on machine1 I would do (for IPv4):

echo 2 > /proc/sys/net/ipv4/conf/<interface_to_outside_net>/rp_filter

and everything would work, but for IPv6 this is not the case since rp_filter is not implemented in the kernel for IPv6 as of yet.
The only solution I know of would be to set up ip6tables.



Current settings:

ip6tables -t raw -N RPFILTER
ip6tables -t raw -A RPFILTER -m rpfilter -j RETURN
ip6tables -t raw -A RPFILTER -m rpfilter --loose -j ACCEPT
ip6tables -t raw -A PREROUTING -j RPFILTER



But for some reason traffic never reaches machine2 and on the client side I get timeout.



Using tcpdump on machine1 I get only the SYN of TCP handshake.:



14:18:50.390292 IP6 fd11:3456:789a:1::4.34184 > fd12:3456:789a:1::1.1111: Flags [S], seq 701159610, win 28800, options [mss 1440,sackOK,TS val 6066549 ecr 0,nop,wscale 7], length 0



nothing else...



Any advice?










share|improve this question













does anyone have a solution to make reverse path filtering work (in loose mode) also for IPv6 and not only for IPv4?



The setup I am having is a machine1 connected directly to a machine2, while machine1 being also connected to outside net.



The targetted traffic is this:
Client (from the outside net) sends a request to the machine1 which then forwards the request to the machine2.



Obvious problem: When packet gets handled by machine1, it forwards it to a port connected to machine2, but with source IP of a client. This would normally be seen as a spoofed ip - but that's what rp_filter is for, right?



Normally on machine1 I would do (for IPv4):

echo 2 > /proc/sys/net/ipv4/conf/<interface_to_outside_net>/rp_filter

and everything would work, but for IPv6 this is not the case since rp_filter is not implemented in the kernel for IPv6 as of yet.
The only solution I know of would be to set up ip6tables.



Current settings:

ip6tables -t raw -N RPFILTER
ip6tables -t raw -A RPFILTER -m rpfilter -j RETURN
ip6tables -t raw -A RPFILTER -m rpfilter --loose -j ACCEPT
ip6tables -t raw -A PREROUTING -j RPFILTER



But for some reason traffic never reaches machine2 and on the client side I get timeout.



Using tcpdump on machine1 I get only the SYN of TCP handshake.:



14:18:50.390292 IP6 fd11:3456:789a:1::4.34184 > fd12:3456:789a:1::1.1111: Flags [S], seq 701159610, win 28800, options [mss 1440,sackOK,TS val 6066549 ecr 0,nop,wscale 7], length 0



nothing else...



Any advice?







iptables ipv6 sysctl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 at 14:53









Diavel

1




1












  • What Linux distribution did you use? What kernel version? What firewall?
    – Michael Hampton
    Nov 26 at 15:54










  • OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
    – Diavel
    Nov 27 at 7:47










  • I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
    – Diavel
    Nov 27 at 12:05






  • 1




    Are you sure that machine1 is actually routing traffic?
    – Michael Hampton
    Nov 27 at 12:08










  • Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
    – Diavel
    Nov 27 at 12:42


















  • What Linux distribution did you use? What kernel version? What firewall?
    – Michael Hampton
    Nov 26 at 15:54










  • OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
    – Diavel
    Nov 27 at 7:47










  • I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
    – Diavel
    Nov 27 at 12:05






  • 1




    Are you sure that machine1 is actually routing traffic?
    – Michael Hampton
    Nov 27 at 12:08










  • Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
    – Diavel
    Nov 27 at 12:42
















What Linux distribution did you use? What kernel version? What firewall?
– Michael Hampton
Nov 26 at 15:54




What Linux distribution did you use? What kernel version? What firewall?
– Michael Hampton
Nov 26 at 15:54












OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
– Diavel
Nov 27 at 7:47




OS Ubuntu 18.04 (xenial), kernel 4.4.0-139-generic, firewall not configured at all. Those commands above are the first I used. Default policy is set to ACCEPT if I check iptables.
– Diavel
Nov 27 at 7:47












I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
– Diavel
Nov 27 at 12:05




I also tried running only with ip6tables -t raw -A PREROUTING -m rpfilter --loose -j ACCEPT .. but did not help
– Diavel
Nov 27 at 12:05




1




1




Are you sure that machine1 is actually routing traffic?
– Michael Hampton
Nov 27 at 12:08




Are you sure that machine1 is actually routing traffic?
– Michael Hampton
Nov 27 at 12:08












Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
– Diavel
Nov 27 at 12:42




Well it should be (again its doing the routing for IPv4), but something's gotta be wrong for IPv6. I am tracing the packets in iptables now.
– Diavel
Nov 27 at 12:42










1 Answer
1






active

oldest

votes

















up vote
0
down vote













SPOILER



The problem was actually related to the fact that I did not set up the IPv6 addresses using /etc/network/interfaces/ but "only" using ip a a ....
I never thought that this could somehow be a different, but it turned out to be the case this time.



STEPS leading to SOLUTION:



During the investigation I did a simple ping6 from machine2 towards machine1 which strangely fixed the problem I was having.



After this, the TCP handshake got correctly created and I was able to do a curl -g -6 .. which was the target command I wanted to do and I was like YES finally!



But then I was like ...this doesn't make sense, why is ICMPv6 not taking care of this?
This made me thinking that I should check ndp (ip -6 neigh show) table which actually showed me that entry for machine1 had FAILED.



Which means that for some reason ICMPv6 was failing to exchange neighbor solicitations/advertisements.



At the end I remembered that simple pc reboot usually fixes all the problems, but since I configured my interfaces using only ip a a ... this would flush my configuration, so what I did was configured /etc/network/interfaces/ with proper IPv6 addresses and rebooted machines.



This was the source of all the problems ;)



SOLUTION:



Don't do anything in regards of rp_filter in loose mode for IPv6 ==> it's enabled by default.



Just make sure, that you have properly configured your interfaces :)



PS: Does anyone know what I messed up? Why wasn't I able to simply use ip address add....? Thanks.






share|improve this answer








New contributor




Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f484224%2fenabling-rp-filter-loose-2-mode-for-ipv6%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








    up vote
    0
    down vote













    SPOILER



    The problem was actually related to the fact that I did not set up the IPv6 addresses using /etc/network/interfaces/ but "only" using ip a a ....
    I never thought that this could somehow be a different, but it turned out to be the case this time.



    STEPS leading to SOLUTION:



    During the investigation I did a simple ping6 from machine2 towards machine1 which strangely fixed the problem I was having.



    After this, the TCP handshake got correctly created and I was able to do a curl -g -6 .. which was the target command I wanted to do and I was like YES finally!



    But then I was like ...this doesn't make sense, why is ICMPv6 not taking care of this?
    This made me thinking that I should check ndp (ip -6 neigh show) table which actually showed me that entry for machine1 had FAILED.



    Which means that for some reason ICMPv6 was failing to exchange neighbor solicitations/advertisements.



    At the end I remembered that simple pc reboot usually fixes all the problems, but since I configured my interfaces using only ip a a ... this would flush my configuration, so what I did was configured /etc/network/interfaces/ with proper IPv6 addresses and rebooted machines.



    This was the source of all the problems ;)



    SOLUTION:



    Don't do anything in regards of rp_filter in loose mode for IPv6 ==> it's enabled by default.



    Just make sure, that you have properly configured your interfaces :)



    PS: Does anyone know what I messed up? Why wasn't I able to simply use ip address add....? Thanks.






    share|improve this answer








    New contributor




    Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      SPOILER



      The problem was actually related to the fact that I did not set up the IPv6 addresses using /etc/network/interfaces/ but "only" using ip a a ....
      I never thought that this could somehow be a different, but it turned out to be the case this time.



      STEPS leading to SOLUTION:



      During the investigation I did a simple ping6 from machine2 towards machine1 which strangely fixed the problem I was having.



      After this, the TCP handshake got correctly created and I was able to do a curl -g -6 .. which was the target command I wanted to do and I was like YES finally!



      But then I was like ...this doesn't make sense, why is ICMPv6 not taking care of this?
      This made me thinking that I should check ndp (ip -6 neigh show) table which actually showed me that entry for machine1 had FAILED.



      Which means that for some reason ICMPv6 was failing to exchange neighbor solicitations/advertisements.



      At the end I remembered that simple pc reboot usually fixes all the problems, but since I configured my interfaces using only ip a a ... this would flush my configuration, so what I did was configured /etc/network/interfaces/ with proper IPv6 addresses and rebooted machines.



      This was the source of all the problems ;)



      SOLUTION:



      Don't do anything in regards of rp_filter in loose mode for IPv6 ==> it's enabled by default.



      Just make sure, that you have properly configured your interfaces :)



      PS: Does anyone know what I messed up? Why wasn't I able to simply use ip address add....? Thanks.






      share|improve this answer








      New contributor




      Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        SPOILER



        The problem was actually related to the fact that I did not set up the IPv6 addresses using /etc/network/interfaces/ but "only" using ip a a ....
        I never thought that this could somehow be a different, but it turned out to be the case this time.



        STEPS leading to SOLUTION:



        During the investigation I did a simple ping6 from machine2 towards machine1 which strangely fixed the problem I was having.



        After this, the TCP handshake got correctly created and I was able to do a curl -g -6 .. which was the target command I wanted to do and I was like YES finally!



        But then I was like ...this doesn't make sense, why is ICMPv6 not taking care of this?
        This made me thinking that I should check ndp (ip -6 neigh show) table which actually showed me that entry for machine1 had FAILED.



        Which means that for some reason ICMPv6 was failing to exchange neighbor solicitations/advertisements.



        At the end I remembered that simple pc reboot usually fixes all the problems, but since I configured my interfaces using only ip a a ... this would flush my configuration, so what I did was configured /etc/network/interfaces/ with proper IPv6 addresses and rebooted machines.



        This was the source of all the problems ;)



        SOLUTION:



        Don't do anything in regards of rp_filter in loose mode for IPv6 ==> it's enabled by default.



        Just make sure, that you have properly configured your interfaces :)



        PS: Does anyone know what I messed up? Why wasn't I able to simply use ip address add....? Thanks.






        share|improve this answer








        New contributor




        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        SPOILER



        The problem was actually related to the fact that I did not set up the IPv6 addresses using /etc/network/interfaces/ but "only" using ip a a ....
        I never thought that this could somehow be a different, but it turned out to be the case this time.



        STEPS leading to SOLUTION:



        During the investigation I did a simple ping6 from machine2 towards machine1 which strangely fixed the problem I was having.



        After this, the TCP handshake got correctly created and I was able to do a curl -g -6 .. which was the target command I wanted to do and I was like YES finally!



        But then I was like ...this doesn't make sense, why is ICMPv6 not taking care of this?
        This made me thinking that I should check ndp (ip -6 neigh show) table which actually showed me that entry for machine1 had FAILED.



        Which means that for some reason ICMPv6 was failing to exchange neighbor solicitations/advertisements.



        At the end I remembered that simple pc reboot usually fixes all the problems, but since I configured my interfaces using only ip a a ... this would flush my configuration, so what I did was configured /etc/network/interfaces/ with proper IPv6 addresses and rebooted machines.



        This was the source of all the problems ;)



        SOLUTION:



        Don't do anything in regards of rp_filter in loose mode for IPv6 ==> it's enabled by default.



        Just make sure, that you have properly configured your interfaces :)



        PS: Does anyone know what I messed up? Why wasn't I able to simply use ip address add....? Thanks.







        share|improve this answer








        New contributor




        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Nov 29 at 12:53









        Diavel

        1




        1




        New contributor




        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Diavel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2funix.stackexchange.com%2fquestions%2f484224%2fenabling-rp-filter-loose-2-mode-for-ipv6%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

            Morgemoulin

            Scott Moir

            Souastre