Skip to contentSkip to conversation

filter on ethernet alias

DISCUSSION Ron Peterson 3 participants 3 messages Sep 4, 2003 – Sep 5, 2003

lore
Share & tools
lore
#0 lore raw

I've found several threads on the topic in the list archives, but the solutions presented don't quite match my situation.

Putting the aliases issue aside for the moment, here's the application. I configure dhcp to set a linux box's ip address to be the default gateway for certain hosts. Then I use iptables rules to DNAT traffic destined for ports 80/443 to to a box (could be same box) running apache on say ports 8080/8443. Apache simply redirects traffic to these ports to a particular URL. So for example, unregistered computers get directed to a web page that says they have to register their computer before they'll get off-campus Internet access.

Now I'd like to direct certain people to one page, and others to a different page (e.g. their machine has been identified as being hacked, so they get directed to a page telling them what to do).

So I was thinking I could do this by aliasing multiple IP's to a single interface, and filter based on the virtual interface. Can't do this, I guess. Neither can I filter on destination IP, because the box is a gateway, not a destination. Is there any way to filter a packet based on which gateway ip address it was sent to, if both addresses are assigned to the same interface?

Signature · 4 lines
Ron Peterson                          -o)
Network & Systems Manager             /\\
Mount Holyoke College                _\_v
http://www.mtholyoke.edu/~rpeterso   ---- 
#1 lore raw
Quoted 16 lines · --- Ron Peterson

I've found several threads on the topic in the list archives, but the solutions presented don't quite match my situation.

Putting the aliases issue aside for the moment, here's the application. I configure dhcp to set a linux box's ip address to be the default gateway for certain hosts. Then I use iptables rules to DNAT traffic destined for ports 80/443 to to a box (could be same box) running apache on say ports 8080/8443. Apache simply redirects traffic to these ports to a particular URL. So for example, unregistered computers get directed to a web page that says they have to register their computer before they'll get off-campus Internet access.

Now I'd like to direct certain people to one page, and others to a different page (e.g. their machine has been identified as being hacked, so they get directed to a page telling them what to do).

Quoted 7 lines

So I was thinking I could do this by aliasing multiple IP's to a single interface, and filter based on the virtual interface. Can't do this, I guess. Neither can I filter on destination IP, because the box is a gateway, not a destination. Is there any way to filter a packet based on which gateway ip address it was sent to, if both addresses are assigned to the same interface?

I could be really wrong here but to use virtual IPs or what not the device takes on another name right? like eth0.1 or something like that does it not? You should be able to specify which incoming device to filter from. I have heard that it does not matter if its like eth0.1. As long as its a valid device name it can be used by iptables.

Hope I understood you right and this helps

SBlaze

Quoted 6 lines
Signature · 4 lines
Ron Peterson                          -o)
Network & Systems Manager             /\\
Mount Holyoke College                _\_v
http://www.mtholyoke.edu/~rpeterso   ---- 

=====
"Winky is not knowing how sir, winky is not knowing how?" -=Winky / Harry Potter and the Goblet of Fire=-"

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

#2 lore raw
In reply to Ron Peterson
Quoted 6 lines · Ron Peterson

So I was thinking I could do this by aliasing multiple IP's to a single interface, and filter based on the virtual interface. Can't do this, I guess. Neither can I filter on destination IP, because the box is a gateway, not a destination. Is there any way to filter a packet based on which gateway ip address it was sent to, if both addresses are assigned to the same interface?

No, there isn't.

And it has a simple reason:
The used IP of the gateway is not transmitted in routed packets.

The client resolves the gateway-address from the routing table via arp to the mac-address of the gateway-interface, which will be the same for all virtual interfaces/adresses on this interface.

This mac-address is now stored in the ethernet-header of the ip-packet, with an ip destination-address behinde the gateway.

A forwarded-via-gateway packet is for the gateway only:
"A packet with my ethernet-address (mac), but not one of my ips"

c'ya
sven

Signature · 2 lines
The Internet treats censorship as a routing problem, and routes around it.
(John Gilmore on http://www.cygnus.com/~gnu/)