Adding ebtables entry from kernel module
"Parthiv Shah" <[email protected]> Fri, 16 Apr 2010 18:11:03 +0530
| Newsgroups | gmane.linux.network.bridge.ebtables.user |
|---|---|
| Message-ID | <8D53A0FEE4D94D71AB2A526E92A8C5D5@PARTHIVLAPTOP> |
This is a multi-part message in MIME format. --===============4522187747706546424== Content-Type: multipart/alternative; boundary="----=_NextPart_000_02B2_01CADD90.2F699C40" This is a multi-part message in MIME format. ------=_NextPart_000_02B2_01CADD90.2F699C40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I am new to using ebtables and my requirements is to do L2 NATing of clients connected on the bridge, through WiFi interface. As a proof of concept, I am able to add following rules in ebtables and have the functionality that I want. (this is for one client connected on bridge) 1. ebtables -t nat -A POSTROUTING -o ath0 -j snat --to-src 00:03:7F:12:06:90 --snat-arp --snat-target ACCEPT 2. ebtables -t nat -A PREROUTING -p 0x0800 -i ath0 --ip-dst 192.168.40.239 -j dnat --to-dst 08:00:46:6A:A4:AC --dnat-target ACCEPT 3. ebtables -t nat -A PREROUTING -p 0x0806 -i ath0 --arp-ip-dst 192.168.40.239 -j dnat --to-dst 08:00:46:6A:A4:AC --dnat-target ACCEPT With above rules, client PC (192.168.40.239) is able to ping gateway (through WiFi - WAN interface) and it's packets are properly NATed. Now practically, there will be many clients connected on the bridge and run time they will join and leave the bridge port. So now I need to add/delete these rules (specifically 2 and 3) for each client as and when they join / leave. I was thinking of modifying the ebtables rules from the kernel itself (at the time of dhcp / arp / ip packet flow for any new client). How can I add / delete the above rules (2 and 3), from the kernel module? Basically I don't want to use ebtables user space tool to add/delete rules in ebtables, neither I want to extend ebtables. I just want to be able to create / delete ebtables rule entries from kernel space. Any help on this will be appreciated. Thanks, Parthiv ------=_NextPart_000_02B2_01CADD90.2F699C40 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Dus-ascii" = http-equiv=3DContent-Type> <META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18882"></HEAD> <BODY> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial>Hi,</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 face=3DArial>I am = new to using=20 ebtables and my requirements is to do L2 NATing of clients connected on = the=20 bridge, through WiFi interface.</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 face=3DArial>As a = proof of=20 concept, I am able to add following rules in ebtables and have the = functionality=20 that I want. (this is for one client connected on = bridge)</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 = face=3DArial> 1. ebtables -t=20 nat -A POSTROUTING -o ath0 -j snat --to-src 00:03:7F:12:06:90 --snat-arp = --snat-target ACCEPT<BR> <BR> 2. ebtables -t nat -A PREROUTING = -p=20 0x0800 -i ath0 --ip-dst 192.168.40.239 -j dnat --to-dst = 08:00:46:6A:A4:AC=20 --dnat-target ACCEPT<BR> 3. ebtables -t nat -A PREROUTING -p 0x0806 = -i ath0=20 --arp-ip-dst 192.168.40.239 -j dnat --to-dst 08:00:46:6A:A4:AC = --dnat-target=20 ACCEPT<BR></FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 face=3DArial>With = above rules,=20 client PC (192.168.40.239) is able to ping gateway (through WiFi - WAN=20 interface) and it's packets are properly NATed. Now practically, there = will be=20 many clients connected on the bridge and run time they will join and = leave the=20 bridge port. So now I need to add/delete these rules (specifically 2 and = 3) for=20 each client as and when they join / leave. I was thinking of modifying = the=20 ebtables rules from the kernel itself (at the time of dhcp / arp / ip = packet=20 flow for any new client).</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 face=3DArial>How = can I add /=20 delete the above rules (2 and 3), from the kernel module? Basically I = don't want=20 to use ebtables user space tool to add/delete rules in ebtables, neither = I want=20 to extend ebtables. I just want to be able to create / delete ebtables = rule=20 entries from kernel space.</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2 face=3DArial>Any = help on this=20 will be appreciated.</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial></FONT></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial>Thanks,</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial>Parthiv</FONT></SPAN></DIV> <DIV><SPAN class=3D939571412-16042010></SPAN> </DIV> <DIV><SPAN class=3D939571412-16042010><FONT size=3D2=20 face=3DArial> </DIV></FONT></SPAN> <DIV><FONT size=3D2 face=3DArial></FONT> </DIV></BODY></HTML> ------=_NextPart_000_02B2_01CADD90.2F699C40-- --===============4522187747706546424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --===============4522187747706546424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ebtables-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ebtables-user --===============4522187747706546424==--