View previous topic :: View next topic |
Author |
Message |
cfs n00b
Joined: 14 Dec 2005 Posts: 3
|
Posted: Wed Dec 14, 2005 7:17 pm Post subject: Routing/Firewall Question (SOLVED) |
|
|
EDIT
Bridging the interfaces works fine. Thanks Everybody!
I am having a devil of a time setting this up, and was wondering if anybody could shed some light on my problems.
Here is what I am wanting to do. I am the sysadmin of a campus network, and want to set up a firewal. We have a public /26 subnet, and a private /22 that both sit on the same physical network. The router, which is owned by the state and I have no access to, provides NAT services for the machines that need them.
What I am wanting to do is stick a machine between the router and my network, and have it act as a firewall. It does not need to do NAT (in fact it cannot, or I'd use something like shorewall), but it needs to pass all the traffic on the inside interface to the router, and vice-versa.
As a test setup, I have a machine with 2 NICs, set up as such:
eth0: connected to network at large
eth1: connected directly to my laptop
My laptop is set up with an IP in my public subnet, along with both NICs in the firewall. I have ip forwarding on, and also static routes set up so traffic to the router goes over eth0 and traffic to my laptop over eth1.
From the laptop, I can ping the firewall, on both interfaces. From the firewall, I can ping the laptop and the router. I cannot ping the router from the laptop, or ping the laptop from a machine on my main network. I know the traffic is being forwarded from eth1 to eth0 from checking the TX count displayed from ifconfig, if I set /proc/sys/net/ipv4/ip_forward to 0, the count doesn't change, set to 1, it does. There are no iptables rules on the firewall, either.
Am I approaching this the wrong way? Does anyone have a clue how to do something like this?
Last edited by cfs on Thu Dec 15, 2005 2:37 pm; edited 1 time in total |
|
Back to top |
|
|
morodoch Guru
Joined: 22 Sep 2005 Posts: 523 Location: England
|
Posted: Wed Dec 14, 2005 7:31 pm Post subject: |
|
|
I guess if you have the same subnet addresses on both sides of your firewall, the hosts on either side won't realise that they need to use the firewall to route to each other - try setting host routes, and see if that fixes it.
Without this, both your laptop and the network will think they're directly connected, and not use the firewall.
Does this sound right? _________________ Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.
-- Curtis |
|
Back to top |
|
|
daeghrefn Tux's lil' helper
Joined: 02 Jan 2005 Posts: 112
|
Posted: Wed Dec 14, 2005 9:51 pm Post subject: |
|
|
Your best bet is to configure your nics in a transparent bridge-firewall. Your firewall would then have no IP address, and would be transparent to the network (put it between your hub/switch and the router) but would allow you to set up IPtables rules to filter the traffic to your designs.
I don't see why you couldn't use shorewall for that config. The only difference is you don't need to configure masquerade or nat in any form.
There's a howto that I've seen on tldp.org. Here it is: Bridge + Firewall Howto
I hope that helps. |
|
Back to top |
|
|
cfs n00b
Joined: 14 Dec 2005 Posts: 3
|
Posted: Wed Dec 14, 2005 10:03 pm Post subject: |
|
|
morodoch wrote: | I guess if you have the same subnet addresses on both sides of your firewall, the hosts on either side won't realise that they need to use the firewall to route to each other - try setting host routes, and see if that fixes it.
Without this, both your laptop and the network will think they're directly connected, and not use the firewall.
Does this sound right? |
That doesn't seem to be the problem. I even emptied the routing table of the firewall and added just 2 routes, one for the laptop and one for the router, on their respective interfaces. Using tcpdump, it seems the firewall is refusing to forward the traffic, as I'm not showing anything crossing from one interface to another (ping from the laptop to the router should show up on both interfaces, but it only shows up on the one it's connected to). I've toggled the promiscuous flag on both interfaces, but it makes no difference. Changing the ip on eth1 and the laptop to the private subnet made no difference either, it won't forward the traffic to eth0.
There has got to be something simple I'm missing. This shouldn't be that much of a problem. |
|
Back to top |
|
|
daeghrefn Tux's lil' helper
Joined: 02 Jan 2005 Posts: 112
|
Posted: Wed Dec 14, 2005 10:22 pm Post subject: |
|
|
You can't use routing tables to pass traffic between devices on the same subnet... you need to configure a bridge. Use the bridge, then configure iptables/netfilter to filter traffic (firewall). |
|
Back to top |
|
|
cfs n00b
Joined: 14 Dec 2005 Posts: 3
|
Posted: Thu Dec 15, 2005 12:04 am Post subject: |
|
|
daeghrefn wrote: | You can't use routing tables to pass traffic between devices on the same subnet... you need to configure a bridge. Use the bridge, then configure iptables/netfilter to filter traffic (firewall). |
That was what I was going to try next. We'll see tomorrow if I can get it to work. |
|
Back to top |
|
|
morodoch Guru
Joined: 22 Sep 2005 Posts: 523 Location: England
|
Posted: Thu Dec 15, 2005 12:39 am Post subject: |
|
|
FWIW, I'm pretty sure you *can* use a firewall between hosts on the same net, you just have to add a host route, not a net route, like
Code: | route add -host 192.168.100.10 gw 192.168.100.1 |
_________________ Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.
-- Curtis |
|
Back to top |
|
|
Sheepdogj15 Guru
Joined: 07 Jan 2005 Posts: 430 Location: Backyard
|
Posted: Thu Dec 15, 2005 1:07 am Post subject: |
|
|
you could alternatively set it up so the laptop is on a distinct subnet (e.g. 172.16.0.0 where the private network is 192.168.0.0). but that is overkill... try to get the bridge setup going first. _________________ Sheepdog
Why Risk It? | Samba Howto |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|