Skip to contentSkip to conversation

Doing Bridge with firewalling

DISCUSSION Afshin Lamei 7 participants 15 messages Dec 31, 2002 – Jan 6, 2003

lore
Share & tools
lore
#0 lore raw

Hi,
I want to make my linux box perform both bridging and firewalling(I mean filternig,Nat,etc.)
My linux box has 2 ethernet cards.
1- Is it necessary to disable ip address of both eth0 and eth1? if yes, how to do that?
2- When I try to add eth0 as an interface to the bridge (using brctl addif), It says : "eth0:Setting promiscuous mode." what does it mean? thanks,
--afshin

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

#1 lore raw
Quoted 3 lines · --- Afshin Lamei

1- Is it necessary to disable ip address of both eth0 and eth1? if yes, how
to do that?

how could you do NAT'ing if you removed the IP
addresses?

Quoted 5 lines

2- When I try to add eth0 as an interface to the bridge (using brctl addif),
It says : "eth0:Setting promiscuous mode." what does it mean?
thanks,

It means that the interface will take all frames that are traversing the network it's attached to, even if they aren't supposed to be destined for the device.

=====
Kevin C. McConnell --RHCE-- <Red Hat Certified Engineer>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#2 lore raw
In reply to Afshin Lamei

Mr. Lamei,

Quoted 6 lines · --- Afshin Lamei

Hi,
I want to make my linux box perform both bridging and firewalling(I mean filternig,Nat,etc.)
My linux box has 2 ethernet cards.
1- Is it necessary to disable ip address of both eth0 and eth1? if yes, how to do that?

Yes. You have to remove all addressing data from the config files your distro uses to configure eth0 and eth1. Then you need to use a kernel with CONFIG_BRIDGE and the netfilter-bridge patches applied, and you need the bridge-utils package installed. Those thre items can be found at kernel.org and
http://www.math.leidenuniv.nl/~buytenh/bridge. The Red Hat 8.0 2.4.18-14 kernel has the appropriate infrastructure present.

Once all these conditions have been satisifed, all you need is these commands somewhere in your startup scripts:

modprobe bridge (if the bridging code is modular)
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
brctl stp br0 off
ifconfig br0 $IPADDR netmask $NETMASK up

Quoted 2 lines

2- When I try to add eth0 as an interface to the bridge (using brctl addif), It says : "eth0:Setting promiscuous mode." what does it mean?

It means that brctl has used one of the netdevice ioctl()s to tell the kernel driver to tell the NIC to accept all Ethernet frames traveling over the wire, regardless of their destination. This is needed to make the bridge work; otherwise there would be no bridge.

The website with the briding stuff has documents about bridging.

Quoted 3 lines

thanks,
--afshin

Brad

=====
Brad Chapman

Permanent e-mail: [email protected]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#3 lore raw
Quoted 10 lines · --- Brad Chapman

Yes. You have to remove all addressing data from the config files your distro uses
to configure eth0 and eth1. Then you need to use a kernel with CONFIG_BRIDGE and the netfilter-bridge patches applied, and you need the bridge-utils package installed.
Those thre items can be found at kernel.org and
http://www.math.leidenuniv.nl/~buytenh/bridge. The Red Hat 8.0 2.4.18-14 kernel has
the appropriate infrastructure present.

I have a question though. If he removes all addressing data, how can he do NAT'ing properly?

=====
Kevin C. McConnell --RHCE-- <Red Hat Certified Engineer>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#4 lore raw
Quoted 13 lines · * Kevin McConnell ([email protected]) wrote:
Quoted 10 lines · --- Brad Chapman

Yes. You have to remove all addressing data from the config files your distro uses
to configure eth0 and eth1. Then you need to use a kernel with CONFIG_BRIDGE and the netfilter-bridge patches applied, and you need the bridge-utils package installed.
Those thre items can be found at kernel.org and
http://www.math.leidenuniv.nl/~buytenh/bridge. The Red Hat 8.0 2.4.18-14 kernel has
the appropriate infrastructure present.

Quoted 2 lines

I have a question though. If he removes all addressing data, how can he do NAT'ing properly?

The two havn't got anything to do with each other. NATing is modifying packets as they pass through the router. Addressing is the IP address and whatnot to access the firewall/router. One does not require the other.

Stephen

#5 lore raw
Quoted 7 lines · --- Stephen Frost

The two havn't got anything to do with each other. NATing is modifying
packets as they pass through the router. Addressing is the IP address
and whatnot to access the firewall/router. One does not require the
other.

This leads me to another question then. What are the advantages of not having an IP address assigned to interface(s) of the firewall? Like for instance, if my firewall was the gateway to the outside world, how would I tell machines behind the firewall to get out to the outside world if they didn't have a default route pointing to the internal address of the firewall? Also, how would packets that hit the firewall get routed through the other side?

=====
Kevin C. McConnell --RHCE-- <Red Hat Certified Engineer>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#6 lore raw
Quoted 10 lines · * Kevin McConnell ([email protected]) wrote:
Quoted 7 lines · --- Stephen Frost

The two havn't got anything to do with each other. NATing is modifying
packets as they pass through the router. Addressing is the IP address
and whatnot to access the firewall/router. One does not require the
other.

Quoted 9 lines

This leads me to another question then. What are the advantages of not having an IP address assigned to interface(s) of the firewall? Like for instance, if my firewall was the gateway to the outside world, how would I tell machines behind the firewall to get out to the outside world if they didn't have a default route pointing to the internal address of the firewall? Also, how would packets that hit the firewall get routed through the other side?

A router is not a bridge. The two are different things. You're thinking of things in terms of a 'router'. In order for your computers to reach the external network they have to go through a router, true. A firewall can be implemented as part of a router or as part of a bridge. The only requirement being that the packets are required to pass through the device. If you implemented your firewall as a bridge then the machines on the network wouldn't 'see' it, they would point their default routes to the router on the opposite side of the bridge.

I think the critical point here is that you need to understand what a bridge is and how it works and how it's different from a router.

Stephen

#7 lore raw

I think that we need to clearly define the terminology for Kevin.

Interface - this is a tricky definition. One can refer to the PHYSICAL interface (i.e. ethernet port) as an interface. You can also refer to the LOGICAL interface (i.e. the one to which you allocate an IP address). These two are DIFFERENT. You _might_ be able to make things clearer by using "<ethernet> port" for the physical interface, and "<ip> interface" for the logical interface.

(PDU = protocol data unit)
The names used to refer to the unit of data transfer are different at different layers:
Frames = layer 2 PDUs
Packets = layer 3 PDUs

Bridge - layer 2 device i.e. "link control" layer i.e. transfers frames across physical interfaces.
Router - layer 3 device i.e. network later i.e. transfers packets across logical interfaces.

When you selectively tranfer frames (layer 2 PDUs) across a bridge, its called filtering (frames).
When you selectively transfer packets (layer 3 PDUs) across a firewall, its called firewalling/packet filtering.

I think I got it right :D.

Hence when you downsize your (layer 3) router into a (layer 2) bridge, your neo-bridge becomes a layer 2 entity and disappears from the layer 3 i.e. it is no longer visible at layer 3. Therefore no firewalling, no NAT.

Ranjeet Shetye
Senior Software Engineer
Zultys Technologies
771 Vaqueros Avenue
Sunnyvale CA 94085
USA
[email protected]
http://www.zultys.com/

Quoted 50 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stephen Frost
Sent: Tuesday, December 31, 2002 12:54 PM
To: Kevin McConnell
Cc: Brad Chapman; Afshin Lamei; [email protected]
Subject: Re: Doing Bridge with firewalling

Quoted 11 lines · * Kevin McConnell ([email protected]) wrote:
Quoted 7 lines · --- Stephen Frost

The two havn't got anything to do with each other. NATing is modifying
packets as they pass through the router. Addressing is the IP address
and whatnot to access the firewall/router. One does not require the
other.

This leads me to another question then. What are the

advantages of not

Quoted 3 lines

having an IP address assigned to
interface(s) of the firewall? Like for instance, if my firewall was the gateway to the outside world, how would I tell machines

behind the

Quoted 1 line

firewall to get out to the outside world if they didn't

have a default

Quoted 3 lines

route pointing to the internal address of the
firewall? Also, how would packets that hit the
firewall get routed through the other side?

A router is not a bridge. The two are different things. You're thinking of things in terms of a 'router'. In order for your computers to reach the external network they have to go through a router, true. A firewall can be implemented as part of a router or as part of a bridge. The only requirement being that the packets are required to pass through the device. If you implemented your firewall as a bridge then the machines on the network wouldn't 'see' it, they would point their default routes to the router on the opposite side of the bridge.

I think the critical point here is that you need to understand what a bridge is and how it works and how it's different from a router.

Stephen

#13 lore raw
In reply to Stephen Frost
Quoted 4 lines · --- Stephen Frost

I think the critical point here is that you need to understand what a
bridge is and how it works and how it's different from a router.

Ah, that would be a confusing point for me. I am guessing that an ethernet bridge would allow 2 different segments to talk to each other directly.

=====
Kevin C. McConnell --RHCE-- <Red Hat Certified Engineer>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#8 lore raw
In reply to Ranjeet Shetye
Quoted 3 lines · --- Ranjeet Shetye

I think that we need to clearly define the
terminology for Kevin.

Yes, thank you! :) I am always up for learning new things. So it was just done at layer 2 instead of layer 3. I understand now. BUT, back to what the original poster said. He said that he wanted to have the bridge do firewalling and NAT'ing (If I read his post correctly). So according to what is written below, he can't do that... right?

Quoted 7 lines

Hence when you downsize your (layer 3) router into a (layer 2) bridge,
your neo-bridge becomes a layer 2 entity and disappears from the layer 3
i.e. it is no longer visible at layer 3. Therefore no firewalling, no
NAT.

=====
Kevin C. McConnell --RHCE-- <Red Hat Certified Engineer>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#14 lore raw
In reply to Stephen Frost

On Tue, 31 Dec 2002 15:54:17 -0500,
Stephen Frost <[email protected]> wrote in message <20021231205417.GQ677@ns>:

Quoted 31 lines · * Kevin McConnell ([email protected]) wrote:
Quoted 10 lines
Quoted 7 lines · --- Stephen Frost

The two havn't got anything to do with each other. NATing is modifying
packets as they pass through the router. Addressing is the IP address
and whatnot to access the firewall/router. One does not require the
other.

Quoted 9 lines

This leads me to another question then. What are the advantages of not having an IP address assigned to interface(s) of the firewall? Like for instance, if my firewall was the gateway to the outside world, how would I tell machines behind the firewall to get out to the outside world if they didn't have a default route pointing to the internal address of the firewall? Also, how would packets that hit the firewall get routed through the other side?

A router is not a bridge. The two are different things. You're thinking of things in terms of a 'router'. In order for your computers to reach the external network they have to go through a router, true. A firewall can be implemented as part of a router or as part of a bridge. The only requirement being that the packets are required to pass through the device. If you implemented your firewall as a bridge then the machines on the network wouldn't 'see' it, they would point their default routes to the router on the opposite side of the bridge.

Quoted 3 lines

I think the critical point here is that you need to understand what a bridge is and how it works and how it's different from a router.

..think of is as a relay.

Signature · 4 lines
..med vennlig hilsen = with Kind Regards from Arnt... ;-)
...with a number of polar bear hunters in his ancestry...
  Scenarios always come in sets of three: 
  best case, worst case, and just in case.
#10 lore raw
In reply to Ranjeet Shetye
Quoted 1 line · * Ranjeet Shetye ([email protected]) wrote:

I think I got it right :D.

Unfortunately not quite.

Quoted 4 lines

Hence when you downsize your (layer 3) router into a (layer 2) bridge, your neo-bridge becomes a layer 2 entity and disappears from the layer 3 i.e. it is no longer visible at layer 3. Therefore no firewalling, no NAT.

See, this isn't entirely correct. A bridge passes around ethernet frames, yes, *but* that does *NOT* mean that it can't modify those frames. It can, in fact, modify those frames for NATing purposes. It can also do full state-based firewalling by watching the frames go by and doing exactly what netfilter does today.

There's also an eptables or some such out there for filtering based on raw ethernet frames but basically everything in iptables will work too with the right patches. The only thing that won't is MASQ because your ethernet interfaces don't have an IP address for MASQ to use, *however*, you *CAN* to SNAT/DNAT/etc.

Stephen

#9 lore raw
In reply to Kevin McConnell
Quoted 11 lines · * Kevin McConnell ([email protected]) wrote:
Quoted 2 lines · --- Ranjeet Shetye

I think that we need to clearly define the
terminology for Kevin.

Yes, thank you! :) I am always up for learning new things. So it was just done at layer 2 instead of layer 3. I understand now. BUT, back to what the original poster said. He said that he wanted to have the bridge do firewalling and NAT'ing (If I read his post correctly). So according to what is written below, he can't do that... right?

That's what he was claiming but that's incorrect. I've done it and I've helped other people through the process of doing it. The big thing is to get the patch from the bridge homepage (if it hasn't been incorporated into the main kernel yet).

Stephen

#11 lore raw
In reply to Stephen Frost

hi,

What is eptables?
Where can I get the information about it.

toshihiro

----- Original Message -----
From: "Stephen Frost" <[email protected]>
To: "Ranjeet Shetye" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 02, 2003 12:08 AM
Subject: Re: Doing Bridge with firewalling

Quoted 1 line · * Ranjeet Shetye ([email protected]) wrote:

I think I got it right :D.

Unfortunately not quite.

Quoted 4 lines

Hence when you downsize your (layer 3) router into a (layer 2) bridge, your neo-bridge becomes a layer 2 entity and disappears from the layer 3 i.e. it is no longer visible at layer 3. Therefore no firewalling, no NAT.

See, this isn't entirely correct. A bridge passes around ethernet frames, yes, *but* that does *NOT* mean that it can't modify those frames. It can, in fact, modify those frames for NATing purposes. It can also do full state-based firewalling by watching the frames go by and doing exactly what netfilter does today.

There's also an eptables or some such out there for filtering based on raw ethernet frames but basically everything in iptables will work too with the right patches. The only thing that won't is MASQ because your ethernet interfaces don't have an IP address for MASQ to use, *however*, you *CAN* to SNAT/DNAT/etc.

Stephen