From owner-freebsd-hackers Thu Oct 30 12:49:37 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id MAA09738 for hackers-outgoing; Thu, 30 Oct 1997 12:49:37 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from gabber.c2.net (gabber.c2.net [208.139.36.80]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id MAA09708 for ; Thu, 30 Oct 1997 12:49:21 -0800 (PST) (envelope-from sameer@gabber.c2.net) Received: (from sameer@localhost) by gabber.c2.net (8.8.4/8.8.4) id MAA15533; Thu, 30 Oct 1997 12:48:33 -0800 (PST) From: sameer Message-Id: <199710302048.MAA15533@gabber.c2.net> Subject: Whee, PPP over TCP working To: freebsd-hackers@freebsd.org Date: Thu, 30 Oct 1997 12:48:33 -0800 (PST) X-Mailer: ELM [version 2.4ME+ PL34 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk So I didn't see anything in the archives about how to get PPP over TCP working, so I figured it out myself. =) Here's how to do it.. hopefully someone can integrate this into the docs, etc. On the client, edit ppp.conf as follows: ppptcp: set device remotehost:1324 set dial "" set ifaddr 10.1.1.1 10.1.1.2 On the server, edit ppp.conf as follows: tcpserver: set ifaddr 10.1.1.2 10.1.1.1 If you want to use PAP/CHAP, whatever, then you should add appropriate configuration for PAP/CHAP. On the server, you need to plug the ppp user-land program onto a port. I wrote the following program to do that -- it has zero error-checking, it probably leaks fd's left and right, and it could be improved to do a login/password thing... there's a lot you can do to improve it, but I didn't have the time, I just wanted to put together a proof of concept. #include #include #include #include #include #include int main(void) { int s = socket(PF_INET, SOCK_STREAM, 0); int a; struct sockaddr_in addr; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(1324); addr.sin_family = AF_INET; bind(s, (struct sockaddr *) &addr, sizeof(addr)); listen(s, 15); while(1) { struct sockaddr_in remote; int size; a = accept(s, (struct sockaddr *) &remote, &size); /* Fork the subprocess to do proxying */ if(!fork()) { char *message = "PPP/TCP Server Connected\n"; /* Spit out some stuff to the client to know we're connected */ write(a, message, strlen(message)); /* Dup some fd's and run ppp -direct */ dup2(a, STDOUT_FILENO); dup2(a, STDIN_FILENO); close(a); execl("/usr/sbin/ppp", "ppp", "-direct", "tcpserver", NULL); } } } So then on the server, you just run > ./ppp-tcp Then on the client you can run > ppp ppptcp User Process PPP. Written by Toshiharu OHNO. Log level is 09 can't open /etc/ppp/ppp.secret. Warning: No password entry for this host in ppp.secret Warning: All manipulation is allowed by anyone in the world Using interface: tun0 Interactive mode ppp ON gabber> dial Dial attempt 1 dial OK! login OK! ppp ON gabber> Packet mode. ppp ON gabber> PPP ON gabber> On the server you'll end up seeing: {0} lachesis:sameer/ppp-tcp 12:46pm [14] > ./ppp-tcp Log level is 281 can't open /etc/ppp/ppp.secret. Warning: No password entry for this host in ppp.secret Warning: All manipulation is allowed by anyone in the world then you'll be all set. You can ping, etc. -- Sameer Parekh Voice: 510-986-8770 President FAX: 510-986-8777 C2Net http://www.c2.net/ sameer@c2.net