LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-20-2010, 04:29 AM   #1
AlanCF
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Packet forwarding to tun device on OpenBSD


I set up a PPP connection over a serial cable between a PC running OpenBSD and another PC running Windows 3.1 with Trumpet Winsock. The Windows 3.1 PC doesn't have a NIC in it, but the OpenBSD one does. I can successfully ping the PCs from each other, but the Windows PC can't connect to the internet through the OpenBSD PC. I have set net.ip.forwarding to be 1, so that's not the problem. The OpenBSD PC has one NIC in it, using the we(4) driver. I'm trying to get all packets from the Windows machine to be forwarded to the default gateway (10.0.0.1). And all packets addressed to the Windows machine's address (10.0.0.105) to be forwarded to it. I tried pinging the default gateway from the Windows box and it didn't work.


Please help!
Thanks,
AlanCF

Last edited by AlanCF; 06-20-2010 at 04:38 AM.
 
Old 06-20-2010, 07:29 AM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
If OpenBSD has "tcpdump", use it to find out where your packets go and what IP do they have.
 
1 members found this post helpful.
Old 06-20-2010, 03:19 PM   #3
AlanCF
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I tried tcpdump, and I ran it with the "-i" argument to specify the interface (tun0) that I wanted to listen on. I saw the connection from 10.0.0.105 (windows box) to 10.0.0.2 (another box). I waited, and another of the same message came up. This is because (I think) the windows box couldn't establish a connection, so it timed out, and tried again. I can connect to 10.0.0.2 from 10.0.0.104 (the PPP tunnel server)

http://bin.z80.us/145 (ASCII ART diagram in pastebin because spaces didn't work correctly here)

10.0.0.105 can ping 10.0.0.103 and 10.0.0.104
10.0.0.105 CANNOT ping 10.0.0.2 (on interface we1)
10.0.0.103 can ping 10.0.0.2 (on interface we1)

I need all packets coming from tun0 to be forwarded out interface we1 and to the default gateway (10.0.0.1). It seems that packets coming into tun0 are ignored if their destination address is one other than assigned to an interface on the PPP server.

On both machines I have a default route to 10.0.0.1


Please help!

Thanks,
AlanCF

Last edited by AlanCF; 06-20-2010 at 03:21 PM.
 
Old 06-20-2010, 03:48 PM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Can you execute command on OpenBSD's root console (if it is the same with linux):
route -n

It should give routing table on OpenBSD.
Because, according to your picture, packets from 10.0.0.105 go through 10.0.0.104, then 10.0.0.103, and then they reach 10.0.0.2. And sender is 10.0.0.105, so 10.0.0.2 will replay to it and your router (on OpenBSD) should send that packets to ppp interface, what (I think) it doesn't do.
So we need to know routing table on OpenBSD, please delete ALL private addresses before post.
 
Old 06-20-2010, 04:33 PM   #5
AlanCF
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Okay, I fixed it. Apparrently, the packets were making it to the server, but not back. Because my network uses ARP, I had to configure an ARP entry in the ARP tables on the PPP host (10.0.0.104, 10.0.0.103) so that when the server (10.0.0.2) sent out an ARP request to try to figure out where to send the packets, it got nothing. When I created and ARP entry, the packets were successfully routed back to the computer. Using tcpdump on the interface connected to the internet helped a lot (thanks nimnull22)

Last edited by AlanCF; 06-20-2010 at 04:35 PM.
 
Old 06-20-2010, 07:45 PM   #6
AlanCF
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Another problem just came up. If I have a SSH VPN tunnel, I get tun adapter on both ends. These adapters look like this in ifconfig:

Machine A:
Code:
tun0: flags=51<UP,POINTOPOINT,RUNNING> mtu 1500
	priority: 0
	groups: tun
	media: Ethernet autoselect
	status: active
	inet 10.0.0.201 --> 10.0.0.200 netmask 0xffffff00
Machine B:
Code:
tun0: flags=51<UP,POINTOPOINT,RUNNING> mtu 1500
	priority: 0
	groups: tun
	media: Ethernet autoselect
	status: active
	inet 10.0.0.200 --> 10.0.0.201 netmask 0xffffff00
                                 ^
                            "remote" address
I can ping both sides from each other, but when I enable routing on 10.0.0.201 (Machine A), and add the correct ARP entries, another computer on the same network cannot ping 10.0.0.200 (Machine B) through 10.0.0.201 (Machine A). However, if I change 10.0.0.200 (Machine A)'s "remote" address to be the address of the computer that I'm pinging from, it works. I am trying to figure out how to get rid of the remote address, so that any computer can connect to 10.0.0.200 (Machine B) through 10.0.0.201 (Machine A).

Thanks,
AlanCF

Last edited by AlanCF; 06-20-2010 at 07:47 PM.
 
Old 06-21-2010, 12:09 PM   #7
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
I am trying to figure out how to get rid of the remote address, so that any computer can connect to 10.0.0.200 (Machine B) through 10.0.0.201 (Machine A).
The same way as usual, you need to to add route with GW=tun IP and network behind it.
For instance, if host wants to go to 10.0.0.200 it needs to send packets to GW=10.0.0.201.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vnuml tun device /dev/net/tun not found. asalford Linux - Networking 1 01-30-2007 10:11 PM
packet fragmentation in packet forwarding code cranium2004 Linux - Networking 0 05-16-2005 04:05 AM
TUN device error palanisaravanan Linux - Networking 1 11-24-2004 12:17 AM
Getting FD for an existing tun device alanwolfen Programming 1 10-18-2004 11:39 AM
port forwarding and packet forwarding syrtsardo Linux - Newbie 2 07-03-2003 10:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration