How to configure route so ping will go from one machine to another

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








up vote
2
down vote

favorite












My sincere apologies if I was wrong In that, I published the question but found nothing similar.



I received an exercise in the course in VMware Workstation at I am doing where I was required to perform the following actions Set up two ubuntu server 16.04 virtual machines VM1 VM2 Machine VM1 should do the following: Access a web site where stock exchange stocks are broadcast - download the latest information into a file - CSV/ excel - every five minutes limitation each machine need the have a unique network segment in this case I picked VM1 -192.168.3.0/24 and the static IP of 192.168.3.254 VM2 -192.168.2.0/24 and the static IP of 192.168.2.254 From what I understand the only way the two can talk is put a third machine (which I named Jack - also ubuntu server 16.04) and gave Jack two network adapters 1. 192.168.2.222/24 which respond to ping from VM2 2. 192.168.3.222/24 which respond to ping from VM1



can someone help by explaining what steps I need to do in order I can ping from VM2 to Jack network interface 2 and afterwards to VM 192.168.3.254? of course the ping needs to return back to VM 2







share|improve this question


























    up vote
    2
    down vote

    favorite












    My sincere apologies if I was wrong In that, I published the question but found nothing similar.



    I received an exercise in the course in VMware Workstation at I am doing where I was required to perform the following actions Set up two ubuntu server 16.04 virtual machines VM1 VM2 Machine VM1 should do the following: Access a web site where stock exchange stocks are broadcast - download the latest information into a file - CSV/ excel - every five minutes limitation each machine need the have a unique network segment in this case I picked VM1 -192.168.3.0/24 and the static IP of 192.168.3.254 VM2 -192.168.2.0/24 and the static IP of 192.168.2.254 From what I understand the only way the two can talk is put a third machine (which I named Jack - also ubuntu server 16.04) and gave Jack two network adapters 1. 192.168.2.222/24 which respond to ping from VM2 2. 192.168.3.222/24 which respond to ping from VM1



    can someone help by explaining what steps I need to do in order I can ping from VM2 to Jack network interface 2 and afterwards to VM 192.168.3.254? of course the ping needs to return back to VM 2







    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      My sincere apologies if I was wrong In that, I published the question but found nothing similar.



      I received an exercise in the course in VMware Workstation at I am doing where I was required to perform the following actions Set up two ubuntu server 16.04 virtual machines VM1 VM2 Machine VM1 should do the following: Access a web site where stock exchange stocks are broadcast - download the latest information into a file - CSV/ excel - every five minutes limitation each machine need the have a unique network segment in this case I picked VM1 -192.168.3.0/24 and the static IP of 192.168.3.254 VM2 -192.168.2.0/24 and the static IP of 192.168.2.254 From what I understand the only way the two can talk is put a third machine (which I named Jack - also ubuntu server 16.04) and gave Jack two network adapters 1. 192.168.2.222/24 which respond to ping from VM2 2. 192.168.3.222/24 which respond to ping from VM1



      can someone help by explaining what steps I need to do in order I can ping from VM2 to Jack network interface 2 and afterwards to VM 192.168.3.254? of course the ping needs to return back to VM 2







      share|improve this question














      My sincere apologies if I was wrong In that, I published the question but found nothing similar.



      I received an exercise in the course in VMware Workstation at I am doing where I was required to perform the following actions Set up two ubuntu server 16.04 virtual machines VM1 VM2 Machine VM1 should do the following: Access a web site where stock exchange stocks are broadcast - download the latest information into a file - CSV/ excel - every five minutes limitation each machine need the have a unique network segment in this case I picked VM1 -192.168.3.0/24 and the static IP of 192.168.3.254 VM2 -192.168.2.0/24 and the static IP of 192.168.2.254 From what I understand the only way the two can talk is put a third machine (which I named Jack - also ubuntu server 16.04) and gave Jack two network adapters 1. 192.168.2.222/24 which respond to ping from VM2 2. 192.168.3.222/24 which respond to ping from VM1



      can someone help by explaining what steps I need to do in order I can ping from VM2 to Jack network interface 2 and afterwards to VM 192.168.3.254? of course the ping needs to return back to VM 2









      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 20 at 2:42









      muru

      129k19272462




      129k19272462










      asked Apr 20 at 2:39









      Yoda

      111




      111




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Enable forwarding



          First activate the IPv4 forwarding in your "Jack" server.



          To enable it on the fly you can use :



          echo 1 > /proc/sys/net/ipv4/ip_forward


          To enable it permantly, edit the file /etc/sysctl.confand uncomment the line with net.ipv4.ip_forward = 1. Then reload the conf : sysctl -p /etc/sysctl.conf.



          Define default gateway



          After, you have to define the "Jack" device as the default gateway in your two VM.



          To perform that you can edit directly the file /etc/network/interfaces.



          Example :



          auto eth0
          iface eth0 inet static
          address 192.168.3.254 # VM 1
          netmask 255.255.255.0
          gateway 192.168.3.222 # Interface of jack in the sub net of VM1


          You can add a default route on the fly with the command ip route (with this command you can, if you want, only specify the route for the subnet of each VM).



          sudo ip route add default gw 192.168.3.222 eth0


          Debug/Confirm



          You can check your IP address with the command ip address. Ensure that your IP is correctly defined.



          You can check your route with the command ip route. Ensure that the default route for both of your VM is the "Jack" IP.



          Then, ping from each VM to their Gateway (Jack). And finally ping each VM. Done.



          If this does not work, check the Firewall and edit it if required :



          sudo iptables -L


          Hope this answer help and sorry for my english.






          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',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f1026567%2fhow-to-configure-route-so-ping-will-go-from-one-machine-to-another%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
            0
            down vote













            Enable forwarding



            First activate the IPv4 forwarding in your "Jack" server.



            To enable it on the fly you can use :



            echo 1 > /proc/sys/net/ipv4/ip_forward


            To enable it permantly, edit the file /etc/sysctl.confand uncomment the line with net.ipv4.ip_forward = 1. Then reload the conf : sysctl -p /etc/sysctl.conf.



            Define default gateway



            After, you have to define the "Jack" device as the default gateway in your two VM.



            To perform that you can edit directly the file /etc/network/interfaces.



            Example :



            auto eth0
            iface eth0 inet static
            address 192.168.3.254 # VM 1
            netmask 255.255.255.0
            gateway 192.168.3.222 # Interface of jack in the sub net of VM1


            You can add a default route on the fly with the command ip route (with this command you can, if you want, only specify the route for the subnet of each VM).



            sudo ip route add default gw 192.168.3.222 eth0


            Debug/Confirm



            You can check your IP address with the command ip address. Ensure that your IP is correctly defined.



            You can check your route with the command ip route. Ensure that the default route for both of your VM is the "Jack" IP.



            Then, ping from each VM to their Gateway (Jack). And finally ping each VM. Done.



            If this does not work, check the Firewall and edit it if required :



            sudo iptables -L


            Hope this answer help and sorry for my english.






            share|improve this answer


























              up vote
              0
              down vote













              Enable forwarding



              First activate the IPv4 forwarding in your "Jack" server.



              To enable it on the fly you can use :



              echo 1 > /proc/sys/net/ipv4/ip_forward


              To enable it permantly, edit the file /etc/sysctl.confand uncomment the line with net.ipv4.ip_forward = 1. Then reload the conf : sysctl -p /etc/sysctl.conf.



              Define default gateway



              After, you have to define the "Jack" device as the default gateway in your two VM.



              To perform that you can edit directly the file /etc/network/interfaces.



              Example :



              auto eth0
              iface eth0 inet static
              address 192.168.3.254 # VM 1
              netmask 255.255.255.0
              gateway 192.168.3.222 # Interface of jack in the sub net of VM1


              You can add a default route on the fly with the command ip route (with this command you can, if you want, only specify the route for the subnet of each VM).



              sudo ip route add default gw 192.168.3.222 eth0


              Debug/Confirm



              You can check your IP address with the command ip address. Ensure that your IP is correctly defined.



              You can check your route with the command ip route. Ensure that the default route for both of your VM is the "Jack" IP.



              Then, ping from each VM to their Gateway (Jack). And finally ping each VM. Done.



              If this does not work, check the Firewall and edit it if required :



              sudo iptables -L


              Hope this answer help and sorry for my english.






              share|improve this answer
























                up vote
                0
                down vote










                up vote
                0
                down vote









                Enable forwarding



                First activate the IPv4 forwarding in your "Jack" server.



                To enable it on the fly you can use :



                echo 1 > /proc/sys/net/ipv4/ip_forward


                To enable it permantly, edit the file /etc/sysctl.confand uncomment the line with net.ipv4.ip_forward = 1. Then reload the conf : sysctl -p /etc/sysctl.conf.



                Define default gateway



                After, you have to define the "Jack" device as the default gateway in your two VM.



                To perform that you can edit directly the file /etc/network/interfaces.



                Example :



                auto eth0
                iface eth0 inet static
                address 192.168.3.254 # VM 1
                netmask 255.255.255.0
                gateway 192.168.3.222 # Interface of jack in the sub net of VM1


                You can add a default route on the fly with the command ip route (with this command you can, if you want, only specify the route for the subnet of each VM).



                sudo ip route add default gw 192.168.3.222 eth0


                Debug/Confirm



                You can check your IP address with the command ip address. Ensure that your IP is correctly defined.



                You can check your route with the command ip route. Ensure that the default route for both of your VM is the "Jack" IP.



                Then, ping from each VM to their Gateway (Jack). And finally ping each VM. Done.



                If this does not work, check the Firewall and edit it if required :



                sudo iptables -L


                Hope this answer help and sorry for my english.






                share|improve this answer














                Enable forwarding



                First activate the IPv4 forwarding in your "Jack" server.



                To enable it on the fly you can use :



                echo 1 > /proc/sys/net/ipv4/ip_forward


                To enable it permantly, edit the file /etc/sysctl.confand uncomment the line with net.ipv4.ip_forward = 1. Then reload the conf : sysctl -p /etc/sysctl.conf.



                Define default gateway



                After, you have to define the "Jack" device as the default gateway in your two VM.



                To perform that you can edit directly the file /etc/network/interfaces.



                Example :



                auto eth0
                iface eth0 inet static
                address 192.168.3.254 # VM 1
                netmask 255.255.255.0
                gateway 192.168.3.222 # Interface of jack in the sub net of VM1


                You can add a default route on the fly with the command ip route (with this command you can, if you want, only specify the route for the subnet of each VM).



                sudo ip route add default gw 192.168.3.222 eth0


                Debug/Confirm



                You can check your IP address with the command ip address. Ensure that your IP is correctly defined.



                You can check your route with the command ip route. Ensure that the default route for both of your VM is the "Jack" IP.



                Then, ping from each VM to their Gateway (Jack). And finally ping each VM. Done.



                If this does not work, check the Firewall and edit it if required :



                sudo iptables -L


                Hope this answer help and sorry for my english.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 20 at 17:28

























                answered Apr 20 at 7:56









                Eraseth

                1299




                1299



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1026567%2fhow-to-configure-route-so-ping-will-go-from-one-machine-to-another%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                    Trouble downloading packages list due to a “Hash sum mismatch” error

                    How do I move numbers in filenames, in a batch renaming operation?