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?


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

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.