Forwarding the IP packet from tun0 to/from eth0


 
Thread Tools Search this Thread
Special Forums IP Networking Forwarding the IP packet from tun0 to/from eth0
# 1  
Old 05-19-2009
Forwarding the IP packet from tun0 to/from eth0

Hi all,

I am working on TUN/TAP for tunnelling IP packets from the application to the network.

I am able to open the tun device and assign the IP address to tun0. The steps I followed are given,

1. Opened the tun device /dev/net/tun
2. Assigned a IP address to the tun0 using ifconfig tun0 10.66.67.247
3. Added to the routing table using the following command route add -host 10.66.67.247 dev tun0
4. I have loaded the tun device using modprobe tun and I was able to see the device when I gave the command lsmod | sort
Code:
         tsdev                   7520  0 
         tun                    10336  1

5. the output of the command route is
Code:
10.66.67.247    *   255.255.255.255     UH    0      0        0 tun0
10.66.67.192    *   255.255.255.192     U     0      0        0 eth0
default 10.66.67.193    0.0.0.0         UG    0      0        0 eth0

6. I have installed uml-utilities & bridge utilities.
7. finally I wrote a IP frame to tun0 device . The IP packet was for opening a ftp session on other machine (10.66.67.220.

I could seee the packet received in tun0 device using ifconfig and wireshark.

Code:
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.66.67.247  P-t-P:10.66.67.247  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:60 (60.0 b)  TX bytes:0 (0.0 b)

The IP Packet which I sent is received in the tun0 device, but furhter its not been routed to the eth0 device.

My question is, how do I route the IP packets recevied in tun0 device to the network via eth0 and vice versa.

Is there any package or driver i need to install inorder to configure the tun device for routing it to the eth0

Thanks for your inputs in Advance
Johnnie Alan J
# 2  
Old 06-04-2009
Turn on FORWARDing.
# 3  
Old 06-05-2009
hi,

Thanks for your inputs.

But may i know which forwarding your are talking about. do you mean /proc/sys/net/ipv4/ip_forward? .

I have enabled in the file mentioned above


regards
johnnie alan j
# 4  
Old 06-10-2009
hi johnie,

i'm a bit unclear here,
can you draw us a small picture what are you trying to accomplish?
# 5  
Old 06-11-2009
hi all,

I am sending an IP packet to another machine on the same LAN using tun0 device. The Packet is traversed through PREROUTING and doesnt go the FORWARD chain.

tun0 (10.66.67.247) <-------> eth0 (10.66.67.208)<----> machine2 ( 10.66.67.220)

I am send an IP packet to 220 machine.

Tun0 is up and running.

Thanks in advance
Alan J
# 6  
Old 07-10-2009
[quote=johnniealan;302324481
tun0 (10.66.67.247) <-------> eth0 (10.66.67.208)<----> machine2 ( 10.66.67.220)[/quote]

Are both of these ip address on the same machine? I don't see any eth# on the side for machine 2.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Packet forwarding to network stack

hello All, I am not heavily conversant with *nix, so few of you may find the question to be naive. Question : Will *nix Kernel process packets not originating from a loopback interface, but received on a loopback interface? Scenario: I have an application running which can strip packets... (2 Replies)
Discussion started by: brownbytes
2 Replies

2. AIX

Packet loss coming with big packet size ping

(5 Replies)
Discussion started by: Vishal_dba
5 Replies

3. Red Hat

Eth0 Limitations

Hi, I have noticed some performance issues on my RHEL5 server but the memory and CPU utilization on the box is fine. I have a 1G full duplexed eth0 card and I am suspicious that this may be causing the problem. My eth0 settings are as follows: Settings for eth0: Supported ports: ... (12 Replies)
Discussion started by: Duffs22
12 Replies

4. Red Hat

Device eth0 issue

Hi, I have just installed RHEL 5.4 on a BL430c-class server and I am attempting to connect to the network only when I try and start eth0, I get the following error? "Bringing up Interface eth0: hp device eth0 does not seem to be present, delaying initialization." I am using a HP... (18 Replies)
Discussion started by: Duffs22
18 Replies

5. UNIX for Dummies Questions & Answers

how can I find which one is eth0?

Hi, Just installed Centos 5.1 on HP DL360, on this system I have to close to ten nic's. How can I find which one is eth0? When I do " ifconfig -a" I see all of them, but I can't tell which is eth0? Please advice. (2 Replies)
Discussion started by: samnyc
2 Replies

6. Cybersecurity

ssh X-forwarding and remote forwarding behind proxy

Hi, from my workplace we use a proxy to connect to the outside world, including external ssh servers. The problem is that the server is seeing the connection coming from the proxy and knows nothing about the client behind it. The ssh connection itself works fine, but x-forwarding does not work as... (1 Reply)
Discussion started by: vampirodolce
1 Replies

7. IP Networking

Iptables/TC: how to make masqueraded traffic go through an openVPN tun0?

Hi all! We have a setup of three computers; Machine A (eth0) -> Machine B (eth0, hso0, tun0) -> Machine C (eth0, tun0) hso0 is the packet interface of a 3G modem, it behaves like a normal network interface. Machine B and C are connected in a VPN using openVPN (TCP). Machine A is a... (2 Replies)
Discussion started by: theVOID
2 Replies

8. Ubuntu

Trying to config eth0 - Ubuntu

Greetings, I have installed a Ubuntu server and attempting put a static IP address on interface ETH0. I edited the /etc/network/interfaces with the following: auto eth0 iface eth0 inet static address 192.168.203.270 gateway 192.168.203.1 netwask 255.255.255.0 network 192.168.0.0... (2 Replies)
Discussion started by: jroberson
2 Replies

9. Red Hat

ifcfg-eth0 and eth1 is N/A

when i finish installed rhel 4.4 to my hp dl585 box, ifcfg-eth0 and ifcfg-eth1 is not available.when i ifconfig -a,i can not see the eth0 and eth1, only lo0 and si0. Unlike to the other server i found eth0 and eth1 files in /etc/sysconfig/network-scripts/. what will i do? (2 Replies)
Discussion started by: kenshinhimura
2 Replies

10. IP Networking

Adding an IP to eth0

Hi there guys! I have a small task that I have to accomplish, but I don't seem to be able to do that. I have a server that I don't have physical access to, and I mostly control it with webmin. The server is running 2 websites. Both of these websites have their own domains that are linked to... (1 Reply)
Discussion started by: D-Lexy
1 Replies
Login or Register to Ask a Question