Force internet traffic through wifi

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I currently have a setup where my rpi 3b (raspbian jessie), is connected to two routers, using eth0 and wlan0. I want to using eth0 only to communicate with another device in tha LAN. And i want to use wlan0 for WAN traffic via the router.



  • RPI eth0 -> router A -> Device in LAN. (RPI assigned IP in range 10.x.x.x)

  • RPI wlan0 -> router B -> any WAN traffic. (RPI assigned static IP 192.168.1.13)

is it enough to use the route command, something like this below?



sudo route del default
sudo route add default gw 192.168.1.1 (let's say this is the IP address of the router i want to use for internet)


however i was advised to avoid using the route command, since it is overwritten by most network configuration commands.







share|improve this question

























    up vote
    0
    down vote

    favorite












    I currently have a setup where my rpi 3b (raspbian jessie), is connected to two routers, using eth0 and wlan0. I want to using eth0 only to communicate with another device in tha LAN. And i want to use wlan0 for WAN traffic via the router.



    • RPI eth0 -> router A -> Device in LAN. (RPI assigned IP in range 10.x.x.x)

    • RPI wlan0 -> router B -> any WAN traffic. (RPI assigned static IP 192.168.1.13)

    is it enough to use the route command, something like this below?



    sudo route del default
    sudo route add default gw 192.168.1.1 (let's say this is the IP address of the router i want to use for internet)


    however i was advised to avoid using the route command, since it is overwritten by most network configuration commands.







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I currently have a setup where my rpi 3b (raspbian jessie), is connected to two routers, using eth0 and wlan0. I want to using eth0 only to communicate with another device in tha LAN. And i want to use wlan0 for WAN traffic via the router.



      • RPI eth0 -> router A -> Device in LAN. (RPI assigned IP in range 10.x.x.x)

      • RPI wlan0 -> router B -> any WAN traffic. (RPI assigned static IP 192.168.1.13)

      is it enough to use the route command, something like this below?



      sudo route del default
      sudo route add default gw 192.168.1.1 (let's say this is the IP address of the router i want to use for internet)


      however i was advised to avoid using the route command, since it is overwritten by most network configuration commands.







      share|improve this question













      I currently have a setup where my rpi 3b (raspbian jessie), is connected to two routers, using eth0 and wlan0. I want to using eth0 only to communicate with another device in tha LAN. And i want to use wlan0 for WAN traffic via the router.



      • RPI eth0 -> router A -> Device in LAN. (RPI assigned IP in range 10.x.x.x)

      • RPI wlan0 -> router B -> any WAN traffic. (RPI assigned static IP 192.168.1.13)

      is it enough to use the route command, something like this below?



      sudo route del default
      sudo route add default gw 192.168.1.1 (let's say this is the IP address of the router i want to use for internet)


      however i was advised to avoid using the route command, since it is overwritten by most network configuration commands.









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jun 14 at 14:14
























      asked Jun 14 at 10:44









      LecauseAndThePi

      11




      11




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          I'm not sure what you mean by route command being overwritten by config,
          but you can use ip command instead (from iproute* package):



          sudo ip route replace default via 192.168.1.1
          sudo ip route flush cache


          Both commands manage (view/edit) routing table entries.



          A bit of advice - you can have the ethernet interface manually configured
          without setting a default gateway on it (just an ip address and manual/dynamic
          routing if necessary). If that's not an option you can configure dhcp client
          to reject default gateway option on that interface (eth0).






          share|improve this answer





















          • Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
            – LecauseAndThePi
            Jun 14 at 13:03











          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: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f449767%2fforce-internet-traffic-through-wifi%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          I'm not sure what you mean by route command being overwritten by config,
          but you can use ip command instead (from iproute* package):



          sudo ip route replace default via 192.168.1.1
          sudo ip route flush cache


          Both commands manage (view/edit) routing table entries.



          A bit of advice - you can have the ethernet interface manually configured
          without setting a default gateway on it (just an ip address and manual/dynamic
          routing if necessary). If that's not an option you can configure dhcp client
          to reject default gateway option on that interface (eth0).






          share|improve this answer





















          • Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
            – LecauseAndThePi
            Jun 14 at 13:03















          up vote
          1
          down vote













          I'm not sure what you mean by route command being overwritten by config,
          but you can use ip command instead (from iproute* package):



          sudo ip route replace default via 192.168.1.1
          sudo ip route flush cache


          Both commands manage (view/edit) routing table entries.



          A bit of advice - you can have the ethernet interface manually configured
          without setting a default gateway on it (just an ip address and manual/dynamic
          routing if necessary). If that's not an option you can configure dhcp client
          to reject default gateway option on that interface (eth0).






          share|improve this answer





















          • Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
            – LecauseAndThePi
            Jun 14 at 13:03













          up vote
          1
          down vote










          up vote
          1
          down vote









          I'm not sure what you mean by route command being overwritten by config,
          but you can use ip command instead (from iproute* package):



          sudo ip route replace default via 192.168.1.1
          sudo ip route flush cache


          Both commands manage (view/edit) routing table entries.



          A bit of advice - you can have the ethernet interface manually configured
          without setting a default gateway on it (just an ip address and manual/dynamic
          routing if necessary). If that's not an option you can configure dhcp client
          to reject default gateway option on that interface (eth0).






          share|improve this answer













          I'm not sure what you mean by route command being overwritten by config,
          but you can use ip command instead (from iproute* package):



          sudo ip route replace default via 192.168.1.1
          sudo ip route flush cache


          Both commands manage (view/edit) routing table entries.



          A bit of advice - you can have the ethernet interface manually configured
          without setting a default gateway on it (just an ip address and manual/dynamic
          routing if necessary). If that's not an option you can configure dhcp client
          to reject default gateway option on that interface (eth0).







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jun 14 at 12:05









          jnbrains

          111




          111











          • Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
            – LecauseAndThePi
            Jun 14 at 13:03

















          • Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
            – LecauseAndThePi
            Jun 14 at 13:03
















          Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
          – LecauseAndThePi
          Jun 14 at 13:03





          Thank you for your answer. The issue with route, or ip route as you suggested, is that the changes do not seem to be permanent. If i reboot the device, or unplug and plug back the ethernet cable, all goes back as it was, with eth0 being the "preferred" interface and assigned with lowest metric. I am researching on the other 2 options you suggested. Thanks again
          – LecauseAndThePi
          Jun 14 at 13:03













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449767%2fforce-internet-traffic-through-wifi%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay