Forward traffic between two interfaces on the same host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am new in using iptables so I would like to do a few questions for something that maybe many of you find easy :) 

In particular, I have a laptop with two wireless interfaces, a Wifi and a 3G.  I would like to share the 3G broadband connection available on this laptop with other machines within my home/internal network through the wifi interface.  I would like to ask if such functionality is possible to be implemented using iptables.  

Even more specific what I need is a 'relay'-like functionality.  Let's assume that laptop A has the two interfaces and laptop B has only a wifi interface.  Laptop-B will be connected with laptop A through the wifi and laptop A needs to serve all the internet requests of laptop B through the 3G usb modem interface.  

I think that I need to use rules like the following for laptop A :

(I use the names wifi0 and 3g0 for the corresponding interfaces and xxx.yyy.zzz.www for the ip of the 3G interface)
iptables -A FORWARD -i wifi0 -o 3g0 -j ACCEPT
iptables -A FORWARD -i 3g0 -o wifi0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -o eth0 -j SNAT --to-source xxx.yyy.zzz.www

Do I miss something here ?  Do I need to take care of something else as well?

Thanks a lot for the help




      
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux