Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to match VLAN ids and redirect such http traffic to webserver (?? iptables)? And when at webserver, rewrite URL according to VLAN id?

I would need such thing because our network implements number of VLANs with 802.1x and we would like to show some "banned" users specific web pages.

Thanks for any ideas and insights,


share|improve this question
What kind of firewall are you using? – Dusty Oct 6 '10 at 18:59
Hi, iptables (on debian squeeze). – zeratul021 Oct 6 '10 at 19:36
up vote 0 down vote accepted

If your vlans and your ip addressing follow similar boundaries, then I think it might be easiest to use the ip addresses to control the access.

For example: vlan 100 = 10.100.x.y vlan 101 = 10.101.x.y
or even vlan 100 = 10.100.x.[100-119] vlan 101 = 10.100.x.[120-140]

Web servers don't have access to the vlan id from the packet.

You'd then need to craft your web server rules to do things based on the client ip.

==== EDITED: What about just rewriting the dst ip address from the specific vlans to a an extra interface that can do the layer7 rewriting that you want done? It should be invisible to the end user (as long as that filter stays up). Using iptables to modify layer7 data seems expensive.

share|improve this answer
Hi, well, essentially i know of 2 ways how to do this. Each vlan tags frames carrying single ip subnet. Then you can set X subinterfaces on linux DNS server and wildcard redirect them to the webserver ip. After that you could setup rewrite rules based on remote address attribute. This works as I have it up and running. Second way, that I'm about to try, is by using ebtables. Ebtables can read vland ids and then mark such matching packets with mod mark. After that you can read those marks in iptables, mangle and redirect such traffic to web server, where before mentioned rewrite rules would do. – zeratul021 Oct 6 '10 at 19:35
What I', not sure about is how to setup correct iptables forwarding and mangling so my concept would work. – zeratul021 Oct 6 '10 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.