PPP connection to a virtualbox guest
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/ttyS15and then connecting virtualbox'sCOM1to/dev/ttyS14as a host device - but VirtualBox complains that it can't set options on the port (in this case,/dev/ttyS14is a link to/dev/pts/1). - Configuring VirtualBox's
COM1as a host pipe to/tmp/vbox-serial. Butpppddoesn't know that the commandline option/tmp/vbox-serialis a serial port. - Creating a virtual serial device and linking it to a socket with
socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serialand configuring VirtualBox to connect itsCOM1port to and existing socket at/tmp/vbox-serialusing the host pipe option, but this results inVERR_NET_CONNECTION_REFUSEDon VM startup (/tmp/vbox-serialisprw-rw-r-- 1 root ttyand VirtualBox is running as a user who is a member to thettygroup).
Can anyone point me to the right combination so that VirtualBox and pppd can communicate?
networking ubuntu virtualbox serial-port ppp
add a comment |
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/ttyS15and then connecting virtualbox'sCOM1to/dev/ttyS14as a host device - but VirtualBox complains that it can't set options on the port (in this case,/dev/ttyS14is a link to/dev/pts/1). - Configuring VirtualBox's
COM1as a host pipe to/tmp/vbox-serial. Butpppddoesn't know that the commandline option/tmp/vbox-serialis a serial port. - Creating a virtual serial device and linking it to a socket with
socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serialand configuring VirtualBox to connect itsCOM1port to and existing socket at/tmp/vbox-serialusing the host pipe option, but this results inVERR_NET_CONNECTION_REFUSEDon VM startup (/tmp/vbox-serialisprw-rw-r-- 1 root ttyand VirtualBox is running as a user who is a member to thettygroup).
Can anyone point me to the right combination so that VirtualBox and pppd can communicate?
networking ubuntu virtualbox serial-port ppp
add a comment |
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/ttyS15and then connecting virtualbox'sCOM1to/dev/ttyS14as a host device - but VirtualBox complains that it can't set options on the port (in this case,/dev/ttyS14is a link to/dev/pts/1). - Configuring VirtualBox's
COM1as a host pipe to/tmp/vbox-serial. Butpppddoesn't know that the commandline option/tmp/vbox-serialis a serial port. - Creating a virtual serial device and linking it to a socket with
socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serialand configuring VirtualBox to connect itsCOM1port to and existing socket at/tmp/vbox-serialusing the host pipe option, but this results inVERR_NET_CONNECTION_REFUSEDon VM startup (/tmp/vbox-serialisprw-rw-r-- 1 root ttyand VirtualBox is running as a user who is a member to thettygroup).
Can anyone point me to the right combination so that VirtualBox and pppd can communicate?
networking ubuntu virtualbox serial-port ppp
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/ttyS15and then connecting virtualbox'sCOM1to/dev/ttyS14as a host device - but VirtualBox complains that it can't set options on the port (in this case,/dev/ttyS14is a link to/dev/pts/1). - Configuring VirtualBox's
COM1as a host pipe to/tmp/vbox-serial. Butpppddoesn't know that the commandline option/tmp/vbox-serialis a serial port. - Creating a virtual serial device and linking it to a socket with
socat PTY,link=/dev/ttyS14 PIPE:/tmp/vbox-serialand configuring VirtualBox to connect itsCOM1port to and existing socket at/tmp/vbox-serialusing the host pipe option, but this results inVERR_NET_CONNECTION_REFUSEDon VM startup (/tmp/vbox-serialisprw-rw-r-- 1 root ttyand VirtualBox is running as a user who is a member to thettygroup).
Can anyone point me to the right combination so that VirtualBox and pppd can communicate?
networking ubuntu virtualbox serial-port ppp
networking ubuntu virtualbox serial-port ppp
asked Jan 14 at 10:16
TomTom
22526
22526
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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).
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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).
add a comment |
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).
add a comment |
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).
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).
answered Jan 14 at 13:44
TomTom
22526
22526
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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