Thanks for your reply.
echo 1 > /proc/sys/net/ipv4/ip_forward
This line will enable the ip forwarding.
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
The above statements are to enable post routing through the eth0 device. I tried these commands ,but unfortunately the routing is not happening. The Ip packet which i send is reaching tun0 device but not been routed to eth0.
The third one is not clear. Actually I need only IP packet from <particular IP> has to be routed to tun0 device.
I am sending an IP packet to the local server 10.66.67.220 in the same LAN. The source IP of the packet which I send is 10.66.67.208(eth0) and dest IP is 10.66.67.220.
Do I need to change the source IP to 10.66.67.247(tun0)?.
Here I am writing the IP packet to /dev/net/tun using the FD.
I am assuming that the eth0 device will add the ethernet header to the IP packet and send it across the LAN.
Can you show me the sample code which you used for opening the tun device and its ioctrl.
Thanks in advance,
johnnie alan J