Skip to contentSkip to conversation

LARTC digest, Vol 1 #1564 - 6 msgs

LARTC Aron Brand 2 participants 5 messages Jan 29, 2004 – Feb 8, 2004

lore
Share & tools
lore

Aron Brand

author
#0 lore raw

Martin,

If I understand whay you are suggesting, there is a problem in your
design: It will only work if you use Hide NAT. The problem is that the ip_src = IP0 rule is wrong: The ip_src is not changed by the router and it is not equal to the IP of any of the machine interfaces.

Can you think of a solution that will work in the following reasonabl scenario:
Lets say I have two T1 internet connections connected to one ethernet interface. I do not use Hide-NAT.
I want to guarantee at least 512kbps to HTTP traffic on each line (seperately) in the 'virtual circuit' method that you mentioned.

I see no way do do this unless I can attach a qdisc to a specific virtual interface.

Aron

Quoted 7 lines

Message: 3
Date: Wed, 28 Jan 2004 00:54:39 -0600 (CST)
From: "Martin A. Brown" <[email protected]>
To: Gordan Bobic <[email protected]>
Cc: [email protected]
Subject: Re: [LARTC] Shaping Device Aliases

Quoted 8 lines

Gordan,

I've noticed that you are trying to use aliased IP addresses and traffic control together, and you are a bit frustrated that tc doesn't

handle aliased interface names.

: > > I understand that device aliases (e.g. eth2:3) are not

shapeable.

Quoted 1 line

: > > Does anybody know if this functionality is planned in the

future?

Quoted 5 lines

: >
: > None of the new(er) networking tools recognise device aliases, : > because on all recent linux releases, aliases don't exist. : > the ethX:X notation is a legacy notation used only by the
ifconfig

Quoted 8 lines

: > program. everything else just sees a ethX with more than one IP : > address.
: >
: > So you just run your shaping rules on the real interfaces, and : > restrict it's operation with IP address filtering.
:
: Yes, I am aware of that. However, that makes shaping multiple : independent "streams" going through one interface much more

difficult.

Quoted 6 lines

I don't understand why this becomes much more difficult--it just becomes a little more difficult, depending on the number of IP addresses you have active on a given interface. If you can handle multiple addresses on an interface, then shaping traffic on these (known) addresses shouldn't be much more difficult than managing each

address.

Quoted 11 lines

: The only other thing I can think of is setting up a dummy network : device and giving it the IP addresses on all the non-primary
subnets
: (e.g. multiple DSL lines), and setting up the arp and routing to
make
: the packet actually go via the primary interface.

This sounds like a very confused idea. I'm not sure it's worth the hassle--as I hope I can convince you below.

Quoted 7 lines

[ more stuff snipped ]

: Has anybody got any thoughts on this?

I have some thoughts, which I hope can help you understand why you will be able to use the traffic control tools to accomplish your filtering. For posterity, I'll reiterate some of what has come

before.

Quoted 19 lines

IP aliases don't exist. This is a convention for ifconfig. "ip addr show" will display all IP addresses active on a given interface.

Traffic control is the last thing performed before turning the packet over to the device driver and hardware. Similarly, it is the first thing called on receipt of a packet. See diagrams KPTD [0] and ebtables packet flow [1].

In this case, you can use any number of techniques to identify the packets with tc tools based on their IP addresses--the convenience of the aliased interface naming is simply an obstruction of the real path

the packet takes.

: If this would work, maybe it should be documented in the advanced : routing howto, as I can see how there might be a lot of people out : there who would find it useful.

Quoted 7 lines

Let me suggest a possibility, if we assume a nested configuration. Let's say you have IP0 and IP1 active on interface eth3 and you want to make sure that bandwidth is split 75/25 between these two and you want them to share bandwidth. Classic bandwidth-sharing situation....in the tcng config below, you'd need to #define IP0 and IP1, but then you'd have a simple configuration. If you needed to further subdivide traffic within each of the IP0 and IP1 classes,

you'd have an easy way to do so.

Quoted 7 lines
    dev eth0 {
        egress {
            class ( <$ip0> )  if ip_src = IP0 ;
            class ( <$ip1> )  if ip_src = IP1 ;
            htb () {
                class ( rate 1544kbps, ceil 1544kbps ) {   /* T1 speed

*/

Quoted 7 lines
                    $ip0 = class ( rate 1024kbps, ceil 1544kbps ) ;
                    $ip1 = class ( rate  384kbps, ceil 1544kbps ) ;
                }
            }
        }
    }
Quoted 5 lines

Alternately, you may wish to simulate virtual circuits with each of the IP addresses on a machine. In this case, you could use separate root classes attached to the HTB qdisc, or another class. You can prevent the two classes from competing with each other by setting the rate and ceil to the same value. Here's a very simple permutation of

the above.

Quoted 7 lines
    dev eth0 {
        egress {
            class ( <$ip0> )  if ip_src = IP0 ;
            class ( <$ip1> )  if ip_src = IP1 ;
            htb () {
                class ( rate 1544kbps, ceil 1544kbps ) {   /* T1 speed

*/

Quoted 10 lines
                    $ip0 = class ( rate 1024kbps, ceil 1024kbps ) ;
                    $ip1 = class ( rate  384kbps, ceil  384kbps ) ;
                }
            }
        }
    }

Best of luck, Gordan!

Quoted 7 lines

-Martin

[0] http://www.docum.org/stef.coene/qos/kptd/
[1] http://ebtables.sourceforge.net/br_fw_ia/PacketFlow.png

--
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

Aron,

: If I understand whay you are suggesting, there is a problem in your : design: It will only work if you use Hide NAT.

...and multiple public IPs.

: The problem is that the ip_src = IP0 rule is wrong: The ip_src is not : changed by the router and it is not equal to the IP of any of the : machine interfaces.

OK--maybe the 'ip_src = IP0' rule is not applicable to your situation, but that doesn't make it wrong. You describe a different network configuration than I was envisioning based on Gordan's description.

: Can you think of a solution that will work in the following reasonable : scenario:

I can try!

: Lets say I have two T1 internet connections connected to one ethernet : interface. I do not use Hide-NAT. I want to guarantee at least 512kbps : to HTTP traffic on each line (separately) in the 'virtual circuit' : method that you mentioned.

Are you pushing different networks across each T1? If you have Network-A from ISP-A and Network-B from ISP-B, then you have different addresses to use in your configuration.

See an untested configuration with some fabricated addresses and netmasks below.

  #define NETA 216.109.118.64
  #define NETAMASK 28

  #define NETB 63.209.4.192
  #define NETBMASK 27

  dev eth0 {
      egress {
          class ( <$neta> )  if ip_src:NETAMASK = NETA/NETAMASK ;
          class ( <$netb> )  if ip_src:NETBMASK = NETB/NETBMASK ;
          htb () {
            $neta = class ( rate 512kbps, ceil 512kbps ) ;
             $netb = class ( rate 512kbps, ceil 512kbps ) ;
          }
      }
  }

I would think this should provide a skeleton configuration for limiting outbound (transmitted) traffic originating from separate IP networks on the same host.

: I see no way do do this unless I can attach a qdisc to a specific : virtual interface.

If you are using a single IP network and you have two different providers (you're using BGP or similar), then you could consider marking the packets (fwmark) based on outgoing interface, and perform traffic control based on this mechanism.

These are just some thoughts based on how I interpret your description of your network.

Good luck,

-Martin

Signature · 4 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected]
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#2 lore raw
In reply to Aron Brand

Hi Martin,

The scenario I am working on is the second one - there is one internal network and two ISPs.
How can I do fwmark based on the outgoing interface? Remember that there is just one physical WAN interface, with two IP addresses. Is it possible to fwmark somehow based on the routing decision?

Thanks
Aron

-----Original Message-----
From: Martin A. Brown [mailto:[email protected]]
Sent: Friday, January 30, 2004 12:00 AM
To: Aron Brand
Cc: [email protected]
Subject: Re: [LARTC] RE: LARTC digest, Vol 1 #1564 - 6 msgs

Aron,

: If I understand whay you are suggesting, there is a problem in your : design: It will only work if you use Hide NAT.

...and multiple public IPs.

: The problem is that the ip_src = IP0 rule is wrong: The ip_src is
not
: changed by the router and it is not equal to the IP of any of the : machine interfaces.

OK--maybe the 'ip_src = IP0' rule is not applicable to your situation, but that doesn't make it wrong. You describe a different network configuration than I was envisioning based on Gordan's description.

: Can you think of a solution that will work in the following
reasonable
: scenario:

I can try!

: Lets say I have two T1 internet connections connected to one ethernet : interface. I do not use Hide-NAT. I want to guarantee at least
512kbps
: to HTTP traffic on each line (separately) in the 'virtual circuit' : method that you mentioned.

Are you pushing different networks across each T1? If you have Network-A from ISP-A and Network-B from ISP-B, then you have different addresses to use in your configuration.

See an untested configuration with some fabricated addresses and netmasks below.

  #define NETA 216.109.118.64
  #define NETAMASK 28

  #define NETB 63.209.4.192
  #define NETBMASK 27

  dev eth0 {
      egress {
          class ( <$neta> )  if ip_src:NETAMASK = NETA/NETAMASK ;
          class ( <$netb> )  if ip_src:NETBMASK = NETB/NETBMASK ;
          htb () {
            $neta = class ( rate 512kbps, ceil 512kbps ) ;
             $netb = class ( rate 512kbps, ceil 512kbps ) ;
          }
      }
  }

I would think this should provide a skeleton configuration for limiting outbound (transmitted) traffic originating from separate IP networks on the same host.

: I see no way do do this unless I can attach a qdisc to a specific : virtual interface.

If you are using a single IP network and you have two different providers (you're using BGP or similar), then you could consider marking the packets
(fwmark) based on outgoing interface, and perform traffic control based on this mechanism.

These are just some thoughts based on how I interpret your description of your network.

Good luck,

-Martin

--
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to Aron Brand

Aron,

I do not understand your network. In a prior note, I thought I understood that you had multiple serial (T1) interfaces. If you have multiple interfaces, then your statement about having "one physical WAN interface" is misleading. You may have only one T1 card (physical device), with several logical interfaces (for example, wan0, wan1 ...), which is not an uncommon configuration.

Anyway, I don't understand your network, so cannot help. Please give "ip addr" and a small ASCII netmap.

: The scenario I am working on is the second one - there is one internal : network and two ISPs.

Then you have two WAN interfaces?

: How can I do fwmark based on the outgoing interface?

  iptables -t mangle -A POSTROUTING -o wan0 -j MARK --set-mark $wan0_mark
  iptables -t mangle -A POSTROUTING -o wan1 -j MARK --set-mark $wan1_mark

: Remember that there is just one physical WAN interface, with two IP : addresses. Is it possible to fwmark somehow based on the routing : decision?

I'm not sure. Maybe somebody else can pick up that question. It's certainly possible to use -j ROUTE based on the fwmark, though [0]. I don't really think that will be required in your situation, but I won't know until I understand your network better.

Best of luck,

-Martin

[0] http://netfilter.gnumonks.org/documentation/pomlist/pom-extra.html#ROUTE

Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#4 lore raw
In reply to Aron Brand

Hi,

The machine has two ethernet interfaces: eth0 and eth1.
My LAN is connected to eth0.
The eth1 port is connected to a hub with two Internet routers. eth1 has two IP addresses, one for each router.
Dynamic routing (or some other complex routing mechanism) is used. NAT is not used. It is not possible to change the hardware.

I want to configure traffic shaping. But it is not supported to attach a qdisc to a virtual interface (or in other words to attach a separate qdisc to each one of the two external Ips that are defined on the WAN NIC).

So far this seems to be impossible.

Thanks for your help,
Aron

-----Original Message-----
From: Martin A. Brown [mailto:[email protected]]
Sent: Wednesday, February 04, 2004 4:34 AM
To: Aron Brand
Cc: [email protected]
Subject: RE: [LARTC] RE: LARTC digest, Vol 1 #1564 - 6 msgs

Aron,

I do not understand your network. In a prior note, I thought I understood that you had multiple serial (T1) interfaces. If you have multiple interfaces, then your statement about having "one physical WAN interface"
is misleading. You may have only one T1 card (physical device), with several logical interfaces (for example, wan0, wan1 ...), which is not an uncommon configuration.

Anyway, I don't understand your network, so cannot help. Please give "ip addr" and a small ASCII netmap.

: The scenario I am working on is the second one - there is one
internal
: network and two ISPs.

Then you have two WAN interfaces?

: How can I do fwmark based on the outgoing interface?

iptables -t mangle -A POSTROUTING -o wan0 -j MARK --set-mark
$wan0_mark
iptables -t mangle -A POSTROUTING -o wan1 -j MARK --set-mark
$wan1_mark

: Remember that there is just one physical WAN interface, with two IP : addresses. Is it possible to fwmark somehow based on the routing : decision?

I'm not sure. Maybe somebody else can pick up that question. It's certainly possible to use -j ROUTE based on the fwmark, though [0]. I don't really think that will be required in your situation, but I won't know until I understand your network better.

Best of luck,

-Martin

[0]
http://netfilter.gnumonks.org/documentation/pomlist/pom-extra.html#ROUTE

--
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/