PPP connection to a virtualbox guest












0















For testing some software, I'm trying to set up a PPP connection between an Ubuntu 18.04 host and an Ubuntu 16.04 guest running in VirtualBox. So far I've tried:




  • Creating virtual serial devices on the host with socat PTY,link=/dev/ttyS14 PTY,link=/dev/ttyS15 and then connecting virtualbox's COM1 to /dev/ttyS14 as a host device - but VirtualBox complains that it can't set options on the port (in this case, /dev/ttyS14 is a link to /dev/pts/1).

  • Configuring VirtualBox's COM1 as a host pipe to /tmp/vbox-serial. But pppd doesn't know that the commandline option /tmp/vbox-serial is a serial port.

  • Creating a virtual serial device and linking it to a socket with socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serial and configuring VirtualBox to connect its COM1 port to and existing socket at /tmp/vbox-serial using the host pipe option, but this results in VERR_NET_CONNECTION_REFUSED on VM startup (/tmp/vbox-serial is prw-rw-r-- 1 root tty and VirtualBox is running as a user who is a member to the tty group).


Can anyone point me to the right combination so that VirtualBox and pppd can communicate?










share|improve this question



























    0















    For testing some software, I'm trying to set up a PPP connection between an Ubuntu 18.04 host and an Ubuntu 16.04 guest running in VirtualBox. So far I've tried:




    • Creating virtual serial devices on the host with socat PTY,link=/dev/ttyS14 PTY,link=/dev/ttyS15 and then connecting virtualbox's COM1 to /dev/ttyS14 as a host device - but VirtualBox complains that it can't set options on the port (in this case, /dev/ttyS14 is a link to /dev/pts/1).

    • Configuring VirtualBox's COM1 as a host pipe to /tmp/vbox-serial. But pppd doesn't know that the commandline option /tmp/vbox-serial is a serial port.

    • Creating a virtual serial device and linking it to a socket with socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serial and configuring VirtualBox to connect its COM1 port to and existing socket at /tmp/vbox-serial using the host pipe option, but this results in VERR_NET_CONNECTION_REFUSED on VM startup (/tmp/vbox-serial is prw-rw-r-- 1 root tty and VirtualBox is running as a user who is a member to the tty group).


    Can anyone point me to the right combination so that VirtualBox and pppd can communicate?










    share|improve this question

























      0












      0








      0








      For testing some software, I'm trying to set up a PPP connection between an Ubuntu 18.04 host and an Ubuntu 16.04 guest running in VirtualBox. So far I've tried:




      • Creating virtual serial devices on the host with socat PTY,link=/dev/ttyS14 PTY,link=/dev/ttyS15 and then connecting virtualbox's COM1 to /dev/ttyS14 as a host device - but VirtualBox complains that it can't set options on the port (in this case, /dev/ttyS14 is a link to /dev/pts/1).

      • Configuring VirtualBox's COM1 as a host pipe to /tmp/vbox-serial. But pppd doesn't know that the commandline option /tmp/vbox-serial is a serial port.

      • Creating a virtual serial device and linking it to a socket with socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serial and configuring VirtualBox to connect its COM1 port to and existing socket at /tmp/vbox-serial using the host pipe option, but this results in VERR_NET_CONNECTION_REFUSED on VM startup (/tmp/vbox-serial is prw-rw-r-- 1 root tty and VirtualBox is running as a user who is a member to the tty group).


      Can anyone point me to the right combination so that VirtualBox and pppd can communicate?










      share|improve this question














      For testing some software, I'm trying to set up a PPP connection between an Ubuntu 18.04 host and an Ubuntu 16.04 guest running in VirtualBox. So far I've tried:




      • Creating virtual serial devices on the host with socat PTY,link=/dev/ttyS14 PTY,link=/dev/ttyS15 and then connecting virtualbox's COM1 to /dev/ttyS14 as a host device - but VirtualBox complains that it can't set options on the port (in this case, /dev/ttyS14 is a link to /dev/pts/1).

      • Configuring VirtualBox's COM1 as a host pipe to /tmp/vbox-serial. But pppd doesn't know that the commandline option /tmp/vbox-serial is a serial port.

      • Creating a virtual serial device and linking it to a socket with socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serial and configuring VirtualBox to connect its COM1 port to and existing socket at /tmp/vbox-serial using the host pipe option, but this results in VERR_NET_CONNECTION_REFUSED on VM startup (/tmp/vbox-serial is prw-rw-r-- 1 root tty and VirtualBox is running as a user who is a member to the tty group).


      Can anyone point me to the right combination so that VirtualBox and pppd can communicate?







      networking ubuntu virtualbox serial-port ppp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 14 at 10:16









      TomTom

      22526




      22526






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I eventually got something working over TCP. On the host:



          sudo socat PTY,link=/dev/ttyS14 TCP4-LISTEN:1236
          sudo pppd /dev/ttyS14 4000000 192.168.1.1:192.168.1.2 asyncmap 0 proxyarp lock crtscts modem nodetach noauth


          Configure the guest's COM1 port as:
          * Mode TCP
          * Connect to existing pipe/socket
          * Path/Address 127.0.0.1:1236



          Then in the guest:



          sudo pppd /dev/ttyS0 4000000 asyncmap 0 lock crtscts modem nodetach noauth


          Assuming the link is established okay then setup NAT on the host:



          sudo iptables -A FORWARD -o eth0 -i ppp0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
          sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
          sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


          And setup routing in the guest:



          sudo ip route add default dev ppp0 metric 50


          The VM should now be able to route traffic across the PPP link to the internet (assuming that your host has working internet access through eth0).






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f1394053%2fppp-connection-to-a-virtualbox-guest%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














            I eventually got something working over TCP. On the host:



            sudo socat PTY,link=/dev/ttyS14 TCP4-LISTEN:1236
            sudo pppd /dev/ttyS14 4000000 192.168.1.1:192.168.1.2 asyncmap 0 proxyarp lock crtscts modem nodetach noauth


            Configure the guest's COM1 port as:
            * Mode TCP
            * Connect to existing pipe/socket
            * Path/Address 127.0.0.1:1236



            Then in the guest:



            sudo pppd /dev/ttyS0 4000000 asyncmap 0 lock crtscts modem nodetach noauth


            Assuming the link is established okay then setup NAT on the host:



            sudo iptables -A FORWARD -o eth0 -i ppp0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
            sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
            sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


            And setup routing in the guest:



            sudo ip route add default dev ppp0 metric 50


            The VM should now be able to route traffic across the PPP link to the internet (assuming that your host has working internet access through eth0).






            share|improve this answer




























              0














              I eventually got something working over TCP. On the host:



              sudo socat PTY,link=/dev/ttyS14 TCP4-LISTEN:1236
              sudo pppd /dev/ttyS14 4000000 192.168.1.1:192.168.1.2 asyncmap 0 proxyarp lock crtscts modem nodetach noauth


              Configure the guest's COM1 port as:
              * Mode TCP
              * Connect to existing pipe/socket
              * Path/Address 127.0.0.1:1236



              Then in the guest:



              sudo pppd /dev/ttyS0 4000000 asyncmap 0 lock crtscts modem nodetach noauth


              Assuming the link is established okay then setup NAT on the host:



              sudo iptables -A FORWARD -o eth0 -i ppp0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
              sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
              sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


              And setup routing in the guest:



              sudo ip route add default dev ppp0 metric 50


              The VM should now be able to route traffic across the PPP link to the internet (assuming that your host has working internet access through eth0).






              share|improve this answer


























                0












                0








                0







                I eventually got something working over TCP. On the host:



                sudo socat PTY,link=/dev/ttyS14 TCP4-LISTEN:1236
                sudo pppd /dev/ttyS14 4000000 192.168.1.1:192.168.1.2 asyncmap 0 proxyarp lock crtscts modem nodetach noauth


                Configure the guest's COM1 port as:
                * Mode TCP
                * Connect to existing pipe/socket
                * Path/Address 127.0.0.1:1236



                Then in the guest:



                sudo pppd /dev/ttyS0 4000000 asyncmap 0 lock crtscts modem nodetach noauth


                Assuming the link is established okay then setup NAT on the host:



                sudo iptables -A FORWARD -o eth0 -i ppp0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
                sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
                sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


                And setup routing in the guest:



                sudo ip route add default dev ppp0 metric 50


                The VM should now be able to route traffic across the PPP link to the internet (assuming that your host has working internet access through eth0).






                share|improve this answer













                I eventually got something working over TCP. On the host:



                sudo socat PTY,link=/dev/ttyS14 TCP4-LISTEN:1236
                sudo pppd /dev/ttyS14 4000000 192.168.1.1:192.168.1.2 asyncmap 0 proxyarp lock crtscts modem nodetach noauth


                Configure the guest's COM1 port as:
                * Mode TCP
                * Connect to existing pipe/socket
                * Path/Address 127.0.0.1:1236



                Then in the guest:



                sudo pppd /dev/ttyS0 4000000 asyncmap 0 lock crtscts modem nodetach noauth


                Assuming the link is established okay then setup NAT on the host:



                sudo iptables -A FORWARD -o eth0 -i ppp0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
                sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
                sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


                And setup routing in the guest:



                sudo ip route add default dev ppp0 metric 50


                The VM should now be able to route traffic across the PPP link to the internet (assuming that your host has working internet access through eth0).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 14 at 13:44









                TomTom

                22526




                22526






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1394053%2fppp-connection-to-a-virtualbox-guest%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido