Interface-based firewalling for point-to-point links

Interface-based firewalling for point-to-point links

Post by Riku Saikkon » Mon, 27 Nov 1995 04:00:00



Someone might have noticed that if you have a point-to-point link and an
Ethernet or similar link in the same machine, they have the same interface
(IP) address and thus cannot be firewalled with the normal interface-based
firewall in the Linux (1.2.x at least) networking code. Here's a patch for
that.

This changes the firewalling code so that the interface address specified to
ipfw (iface xxx.xxx.xxx.xxx) is the address of the _other_ end of the link
(not this machine) for point-to-point links (and this machine's address for
all other links, as it has always been).

This has been tested (on my own system for about a week), and I have mailed
it to Alan Cox.

Patch to Linux 1.2.13 linux/net/inet/ip_fw.c follows; I place it in the
public domain. The only fix to /sbin/ipfw this needs is a correction to the
man page to say that the interface address is the other end of the link for
point-to-point links.

--- ip_fw.c.org Fri Nov 17 18:59:46 1995

                         */
                        if(f->fw_via.s_addr && rif)
                        {
-                               if(rif->pa_addr!=f->fw_via.s_addr)
-                                       continue;       /* Mismatch */
+                               /*
+                                * For point-to-point links, the address is
+                                * the address of the other end of the link;
+                                * for others, the interface address
+                                */
+                               if(rif->flags&IFF_POINTOPOINT)
+                               {
+                                       if (rif->pa_dstaddr!=f->fw_via.s_addr)
+                                               continue;       /* Mismatch */
+                               }
+                               else
+                               {
+                                       if (rif->pa_addr!=f->fw_via.s_addr)
+                                               continue;       /* Mismatch */
+                               }
                        }
                        /*
                         *      Drop through - this is a match

--

 
 
 

Interface-based firewalling for point-to-point links

Post by Leonard N. Zubkof » Mon, 27 Nov 1995 04:00:00


  Someone might have noticed that if you have a point-to-point link and an
  Ethernet or similar link in the same machine, they have the same interface
  (IP) address and thus cannot be firewalled with the normal interface-based
  firewall in the Linux (1.2.x at least) networking code. Here's a patch for
  that.

  This changes the firewalling code so that the interface address specified to
  ipfw (iface xxx.xxx.xxx.xxx) is the address of the _other_ end of the link
  (not this machine) for point-to-point links (and this machine's address for
  all other links, as it has always been).

I can't speak for how anyone else has their system configured, but I give
my PPP interface a different local IP address than my ethernet interface,
so this has never been a problem.  I wasn't aware it was reasonable to have
multiple interfaces with the same local IP address.

                Leonard

 
 
 

Interface-based firewalling for point-to-point links

Post by Bob Amsta » Mon, 27 Nov 1995 04:00:00




>  Someone might have noticed that if you have a point-to-point link and an
>  Ethernet or similar link in the same machine, they have the same interface
>  (IP) address and thus cannot be firewalled with the normal interface-based
>  firewall in the Linux (1.2.x at least) networking code. Here's a patch for
>  that.
>  This changes the firewalling code so that the interface address specified to
>  ipfw (iface xxx.xxx.xxx.xxx) is the address of the _other_ end of the link
>  (not this machine) for point-to-point links (and this machine's address for
>  all other links, as it has always been).
>I can't speak for how anyone else has their system configured, but I give
>my PPP interface a different local IP address than my ethernet interface,
>so this has never been a problem.  I wasn't aware it was reasonable to have
>multiple interfaces with the same local IP address.

As a matter of fact, you should never give two different interfaces the same
IP address.  I have one system that many PPP links and one ethernet link, and
I give all of the interfaces unique IP addresses.  Once you do this, everything
including the firewall code works just as it should.
--
--
Bob Amstadt

 
 
 

Interface-based firewalling for point-to-point links

Post by Chris Kosti » Tue, 28 Nov 1995 04:00:00




>Someone might have noticed that if you have a point-to-point link and an
>Ethernet or similar link in the same machine, they have the same interface
>(IP) address and thus cannot be firewalled with the normal interface-based
>firewall in the Linux (1.2.x at least) networking code. Here's a patch for
>that.

I can't say that my machine is configured this way. My ppp interface
has an address assigned by the terminal server I connect to and I use a
private internet address for my ethernet side.

I've also setup a machine whose SLIP interface was xx.xx.xx.2 and the
ethernet interface was xx.xx.xx.4. This worked (and is working) just
fine.

--
Chris

 
 
 

Interface-based firewalling for point-to-point links

Post by Riku Saikkon » Wed, 29 Nov 1995 04:00:00




>  Someone might have noticed that if you have a point-to-point link and an
>  Ethernet or similar link in the same machine, they have the same interface
>  (IP) address and thus cannot be firewalled with the normal interface-based
>  firewall in the Linux (1.2.x at least) networking code. Here's a patch for
>  that.
>I can't speak for how anyone else has their system configured, but I give
>my PPP interface a different local IP address than my ethernet interface,
>so this has never been a problem.  I wasn't aware it was reasonable to have
>multiple interfaces with the same local IP address.

Well, if you don't have IP addresses to waste... And different local and
remote addresses easily generate problems with things like DNS...

I think it's good to have this possibility... And I'm using it. :)

--

"And with great power comes great responsibility. Use it wisely."
 - AD&D 2nd edition Dungeon Master's Guide

 
 
 

Interface-based firewalling for point-to-point links

Post by Riku Saikkon » Sun, 03 Dec 1995 04:00:00




>> >  This changes the firewalling code so that the interface address specified to
>> >  ipfw (iface xxx.xxx.xxx.xxx) is the address of the _other_ end of the link
>> >  (not this machine) for point-to-point links (and this machine's address for
>> >  all other links, as it has always been).
>Good idea. Still better idea: Interfaces have NAMES, dammit. Use them.

Yeah, I thought about that first. But... It's not very good for dynamic
links, like a static-addressed SLIP/PPP server where you want to give only a
few IP addresses firewall access to some services but don't know exactly
which SLIP or PPP link they'll be using...

Also, this method needs no modifications to /sbin/ipfw (just a note in the
man page...).

Quote:>Whereas if you use one IP address for everything, all the tools _except_
>the firewall code works just as it should.

Yep. (Or at least I haven't found anything that didn't work.

Quote:>Being able to reuse one address for multiple interfaces is a Good Thing.
>It doesn't make sense to waste two per link if it can be avoided.

Yep. And especially not two C-class networks per such a link as some routing
configuration documents seem to suggest.

--

"Many are the strange chances of the world, and help oft shall come from
the hands of the weak when the Wise falter." - J. R. R. Tolkien

 
 
 

Interface-based firewalling for point-to-point links

Post by Matthias Urlic » Mon, 04 Dec 1995 04:00:00





> >Good idea. Still better idea: Interfaces have NAMES, dammit. Use them.

> Yeah, I thought about that first. But... It's not very good for dynamic
> links, like a static-addressed SLIP/PPP server where you want to give only a
> few IP addresses firewall access to some services but don't know exactly
> which SLIP or PPP link they'll be using...

Good point. You're right, that makes sense.

Quote:> >Being able to reuse one address for multiple interfaces is a Good Thing.
> >It doesn't make sense to waste two per link if it can be avoided.

> Yep. And especially not two C-class networks per such a link as some routing
> configuration documents seem to suggest.

Two? I'm only aware of documents that use _one_.

These days you can use a /30 subnet (thanks to CIDR) for links that do
require their own network (some ISDN implementations on SysV systems with
brain-dead ancient networking code), but of course it must not be the a
subnetwork of the Ethernet you're otherwise using (that's the fault of the
"ancient networking" part).

Am I _ever_ glad that there are systems like Linux where problems are
_fixable_ when we find them.

--
Facts do not cease to exist because they are ignored.
               --Aldous Huxley
--

Schleiermacherstra?e 12  \  Unix+Linux+Mac    | Phone: ...please use email.
90491 Nrnberg (Germany)  \   Consulting+Networking+Programming+etc'ing     42
          PGP: 1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE
      Click <A HREF="http://smurf.noris.de/~urlichs/finger">here</A>.

 
 
 

Interface-based firewalling for point-to-point links

Post by Eric Wampn » Wed, 06 Dec 1995 04:00:00


: Well, if you don't have IP addresses to waste... And different local and
: remote addresses easily generate problems with things like DNS...

It depends on what you are doing I suppose. What I understand to be
"more" standard, your PPP link has its own address so that it can be
a part of the other network. Your ethernet has its own address so it
can be a part of the local network. As long as

a) If you are routing, and you know it, clap your hands. (sorry)
b) If you are *not* routing, cause either
   1) Your local IP network is on a "illegal", non-routable, or unconnected
      network.
   2) Your local IP is linked by default through another loop, you
      certainly don't want to do something evil like routing.

As I understood it, IP Aliasing was making your machine look like several
different machines.

IP Masqerading was to make machines on your network on ref A.1 available.

Am I missing something? My machine never gets confused about which IP it
is supposed to be using. I have no idea why. :-)

eric
--
---


   ***G'Kar: "Weep for the chicken, Na'Toth. Weep for us all"***

 
 
 

Interface-based firewalling for point-to-point links

Post by Riku Saikkon » Thu, 07 Dec 1995 04:00:00




>: Well, if you don't have IP addresses to waste... And different local and
>: remote addresses easily generate problems with things like DNS...
>"more" standard, your PPP link has its own address so that it can be
>a part of the other network. Your ethernet has its own address so it
>can be a part of the local network. As long as
>a) If you are routing, and you know it, clap your hands. (sorry)

*laugh*

Quote:>IP Masqerading was to make machines on your network on ref A.1 available.

Yes, if you have only one IP address (=that of your gateway machine)
allocated to you. This, of course, is less preferable because it's harder to
configure :), and you can't listen for incoming connections (like ident) on
the other machines.

Quote:>Am I missing something? My machine never gets confused about which IP it

You're missing a third case: (this is from my link, isil.lloke.dna.fi) I
have a 3-bit netmask allocated to my systems (6 IP addresses). One machine,
isil, is connected via a SLIP link to my ISP, and also the gateway for a
small Ethernet network of (currently) two computers. Here, I don't have a C
class network to waste for the one machine on the Ethernet, whereas by
having the same IP address on both interfaces in isil I can route my full
Ethernet network and use all the 6 IPs allocated to me...

--

"The fire's very cosy here, and the food's /very/ good, and there are
Elves when you want them. What more could one want?" - J. R. R. Tolkien

 
 
 

Interface-based firewalling for point-to-point links

Post by Matthias Urlic » Fri, 08 Dec 1995 04:00:00




Quote:

> It depends on what you are doing I suppose. What I understand to be
> "more" standard, your PPP link has its own address so that it can be
> a part of the other network. Your ethernet has its own address so it
> can be a part of the local network. As long as

Actually, there's no need for the local side of a PPP connection to be part
of a remote network. (On the other side, the remote side would be part of
the local network, and you'd either need a separate (sub)net or ProxyARP.)

Quote:> As I understood it, IP Aliasing was making your machine look like several
> different machines.

Yep, either via the aliasing patch or via dummy devices. Both of which have
nothing at all to do with pointopoint links, however.

--

Schleiermacherstra?e 12  \  Unix+Linux+Mac    | Phone: ...please use email.
90491 Nrnberg (Germany)  \   Consulting+Networking+Programming+etc'ing     42
          PGP: 1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE
      Click <A HREF="http://smurf.noris.de/~urlichs/finger">here</A>.

 
 
 

1. tunnel point to point vs physical point to point

If you have 2 systems on a point to point link you would address them
by a /30 block? When creating 'gre' tunnel you can use /32 for example
ip addr add 1.0.0.1 peer 1.0.0.2 dev mydev.

why can't /32 of arbitray addressing be used on a point to point
between 2 systems?

2. KSH-93

3. help on point-to-point link

4. Single user mode problems

5. Point-to-Point links - route IP Block with DSL

6. FreeBsd 3.4 - needed to upgrade gcc ?

7. How to setup a passive Point-to-Point Link for capture

8. Major Linux Locking-up problems! (augh!)

9. Point-to-Point-to-Point-to-Point ad nauseum

10. Point-to-Point-to-Point

11. point to point protocol limit of 4 interfaces

12. sol2.4: What is the point of having a link point to the current directory?

13. Point to point link