Skip to contentSkip to conversation

Newbie question

LARTC suresh 10 participants 14 messages Feb 27, 2002 – Sep 28, 2004

lore
Share & tools
lore

suresh

author
#0 lore raw

Hello All,

I have two Internet link and two LAN networks
I have Redhat-7.1 linux-2.4.17 kernel and 2 NICs
In eth0 172.16.1.1 and eth0:1 192.168.1.1
in eth1 are public ips of isps as eth1 a.b.c.d and eth1:0 w.x..y.z

I want do source routing using ip rule command.

echo 200 isp1 >> /etc/iproute2/rt_tables
ip rule add from 172.16.1.0/24 table isp1
ip rule ls

0:      from all lookup local 
32765:  from 172.16.1.0/24 lookup isp1
32766:  from all lookup main 
32767:  from all lookup default

ip route add default via a.b.c.d dev eth1 table isp1 ip route flush cache

Its work fine when request comes from 172.16.1.0 netwok

When i add
ip route add default via w.x.y.z dev eth1

to forward request from another lan network it works fine but req from 172.16.1.0 does not work

if i remove
ip route del default via w.x.y.z dev eth1

its work well.

Did i leaveout anything in configuration?

Is my confifuration is correct?

Thanks,
Suresh

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

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

#1 lore raw
Quoted 26 lines · suresh

I have two Internet link and two LAN networks
I have Redhat-7.1 linux-2.4.17 kernel and 2 NICs
In eth0 172.16.1.1 and eth0:1 192.168.1.1
in eth1 are public ips of isps as eth1 a.b.c.d and eth1:0 w.x..y.z

I want do source routing using ip rule command.

echo 200 isp1 >> /etc/iproute2/rt_tables
ip rule add from 172.16.1.0/24 table isp1
ip rule ls

0:      from all lookup local 
32765:  from 172.16.1.0/24 lookup isp1
32766:  from all lookup main 
32767:  from all lookup default

ip route add default via a.b.c.d dev eth1 table isp1 ip route flush cache

Its work fine when request comes from 172.16.1.0 netwok

When i add
ip route add default via w.x.y.z dev eth1

to forward request from another lan network it works fine but req from 172.16.1.0 does not work

Quoted 6 lines

if i remove
ip route del default via w.x.y.z dev eth1

its work well.

Did i leaveout anything in configuration?

Yep: by adding the rule:
ip rule add from 172.16.1.0/24 table isp1
everything *WILL* go to table isp1.
In my experience everything even local traffic that matches the rule will go to the isp1 table, and hence will be routed to the gateway.

Use a normal routing table for isp1:
For instance:
ip route add 172.16.1.0/24 dev {right device} scope link to make sure that you can still route back to 172.16.1.0...

Anyway: tcpdumping all of your interfaces will make you clear what is actually happenning.

Thinking about it: it only contains a default route, which means, it only knows that it should route to that default gateway. The default is I guess some sort of end point in a routing table.

Signature · 7 lines
<[email protected]> Telegraaf Elektronische Media  http://wwwijzer.nl
http://leerquoten.monster.org/ http://www.faqs.org/rfcs/rfc1855.html 
Let your government know you value your freedom. Sign the petition:
http://petition.eurolinux.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#2 lore raw
In reply to suresh

Hi Ard,
Actually i need to distribute the traffic to two different routers. So I tried to send traffic from 172.16.1.0/24 to a.b.c.d and another network through
w.x.y.z

Thanks
Suresh

Quoted 51 lines · suresh
Quoted 26 lines

I have two Internet link and two LAN networks
I have Redhat-7.1 linux-2.4.17 kernel and 2 NICs
In eth0 172.16.1.1 and eth0:1 192.168.1.1
in eth1 are public ips of isps as eth1 a.b.c.d and eth1:0 w.x..y.z

I want do source routing using ip rule command.

echo 200 isp1 >> /etc/iproute2/rt_tables
ip rule add from 172.16.1.0/24 table isp1
ip rule ls

0:      from all lookup local
32765:  from 172.16.1.0/24 lookup isp1
32766:  from all lookup main
32767:  from all lookup default

ip route add default via a.b.c.d dev eth1 table isp1 ip route flush cache

Its work fine when request comes from 172.16.1.0 netwok

When i add
ip route add default via w.x.y.z dev eth1

to forward request from another lan network it works fine but req from 172.16.1.0 does not work

Quoted 6 lines

if i remove
ip route del default via w.x.y.z dev eth1

its work well.

Did i leaveout anything in configuration?

Yep: by adding the rule:
ip rule add from 172.16.1.0/24 table isp1
everything *WILL* go to table isp1.
In my experience everything even local traffic that matches the rule will go to the isp1 table, and hence will be routed to the gateway.

Use a normal routing table for isp1:
For instance:
ip route add 172.16.1.0/24 dev {right device} scope link to make sure that you can still route back to 172.16.1.0...

Anyway: tcpdumping all of your interfaces will make you clear what is actually happenning.

Thinking about it: it only contains a default route, which means, it only knows that it should route to that default gateway. The default is I guess some sort of end point in a routing table.

Quoted 5 lines

--
<[email protected]> Telegraaf Elektronische Media http://wwwijzer.nl
http://leerquoten.monster.org/ http://www.faqs.org/rfcs/rfc1855.html
Let your government know you value your freedom. Sign the petition:
http://petition.eurolinux.org/

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

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

#3 lore raw
In reply to suresh
Quoted 21 lines · Ard van Breemen
Quoted 19 lines · suresh

In eth0 172.16.1.1 and eth0:1 192.168.1.1
in eth1 are public ips of isps as eth1 a.b.c.d and eth1:0 w.x..y.z

echo 200 isp1 >> /etc/iproute2/rt_tables
ip rule ls

0:      from all lookup local
32765:  from 172.16.1.0/24 lookup isp1
32766:  from all lookup main
32767:  from all lookup default

ip route add default via a.b.c.d dev eth1 table isp1 ip route flush cache

Its work fine when request comes from 172.16.1.0 netwok
When i add ip route add default via w.x.y.z dev eth1
to forward request from another lan network it works fine but req from 172.16.1.0 does not work
if i remove ip route del default via w.x.y.z dev eth1 its work well.

Quoted 5 lines
Quoted 1 line

Did i leaveout anything in configuration?

Yep: by adding the rule:
ip rule add from 172.16.1.0/24 table isp1
everything *WILL* go to table isp1.

Bzt. Every packet with a source address matching 172.16.1.0 will have table isp1 searched first. If no route comes up for it the packet will still be routed according to table main.

Quoted 2 lines

In my experience everything even local traffic that matches the rule will go to the isp1 table, and hence will be routed to the gateway.

Local traffic should not be routed over this host anyway. The only thing that will break is traffic from this host to the local network.

Quoted 4 lines

Use a normal routing table for isp1:
For instance:
ip route add 172.16.1.0/24 dev {right device} scope link to make sure that you can still route back to 172.16.1.0...

This is good advice. Very good advice. It makes for a much clearer configuration.

Quoted 2 lines

Anyway: tcpdumping all of your interfaces will make you clear what is actually happenning.

Not always. Besides, the information you need is in the routing tables... why not look at that instead and try to figure out what should happen?

(Ofcourse, this will not show programs sneakily changing the TOS of a connection... but still... the information can be found in the routing tables, if you count the cache as a routing table as well... :))

Quoted 3 lines

Thinking about it: it only contains a default route, which means, it only knows that it should route to that default gateway. The default is I guess some sort of end point in a routing table.

Any route is an endpoint. Once a route has been found, the routing algorithm will quit searching, and just route out that route. This has interesting consequences, as the first thing searched is always the cache... and you can even manipulate *that* by hand. >:)

Doei, Arthur.

Signature · 7 lines
  /\    / |      [email protected]      | Work like you don't need the money
 /__\  /  | A friend is someone with whom | Love like you have never been hurt
/    \/__ | you can dare to be yourself   | Dance like there's nobody watching

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#4 lore raw
In reply to suresh
Quoted 6 lines · Arthur van Leeuwen
Quoted 3 lines

Yep: by adding the rule:
ip rule add from 172.16.1.0/24 table isp1
everything *WILL* go to table isp1.

Bzt. Every packet with a source address matching 172.16.1.0 will have table isp1 searched first. If no route comes up for it the packet will still be routed according to table main.

Yes, but that table contains a default route. And since the gateway is accessible, it ends there...

Quoted 4 lines
Quoted 2 lines

In my experience everything even local traffic that matches the rule will go to the isp1 table, and hence will be routed to the gateway.

Local traffic should not be routed over this host anyway. The only thing that will break is traffic from this host to the local network.

If you have a local ip in that network (172.16.1.0/24), and connect to that local ip...

Quoted 6 lines
Quoted 4 lines

Use a normal routing table for isp1:
For instance:
ip route add 172.16.1.0/24 dev {right device} scope link to make sure that you can still route back to 172.16.1.0...

This is good advice. Very good advice. It makes for a much clearer configuration.

It is not only clear, but also necessary in this case. Because the next line is a default route...
Ehhh, unless the machine is not link local to 172.16.1.0/24...

Quoted 8 lines
Quoted 2 lines

Anyway: tcpdumping all of your interfaces will make you clear what is actually happenning.

Not always. Besides, the information you need is in the routing tables... why not look at that instead and try to figure out what should happen?

(Ofcourse, this will not show programs sneakily changing the TOS of a connection... but still... the information can be found in the routing tables, if you count the cache as a routing table as well... :))

Allright, if you are experencied, you only have to do ip route get.... But to become experienced you need to know what is going on.

Quoted 5 lines
Quoted 3 lines

Thinking about it: it only contains a default route, which means, it only knows that it should route to that default gateway. The default is I guess some sort of end point in a routing table.

Any route is an endpoint. Once a route has been found, the routing algorithm will quit searching, and just route out that route. This has interesting

Unless the gateway is considered dead, and an alternate route exists...

Quoted 2 lines

consequences, as the first thing searched is always the cache... and you can even manipulate *that* by hand. >:)

Interesting side effects as in, "hey, it suddenly does not work anymore!". :)

Signature · 7 lines
<[email protected]> Telegraaf Elektronische Media  http://wwwijzer.nl
http://leerquoten.monster.org/ http://www.faqs.org/rfcs/rfc1855.html 
Let your government know you value your freedom. Sign the petition:
http://petition.eurolinux.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#5 lore raw

[LARTC] newbie question

In reply to suresh

Can someone kick me in the right direction on this one? I searched the archive and saw nothing. Google didn't help either.

Using tc, I get good results and flow control on a small network. I have an old device that sends a 8808 pause frame back to the main linux router to have it throttle back. But then instead of slowing down and allocating bandwidth by the rules set up, it slows down the bandwidth and gives equal time to all types of packets. Is there a reason it dumps tc control and goes to interleaving flow control?

TIA

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

#7 lore raw

Re: [LARTC] newbie question

In reply to suresh
Quoted 3 lines

in this schema in what device i should implement shapping (htb)

ISP-----eth0 -eth1----LAN

If you implement your shaping/scheduling on eth1, then your LAN will be affected, but not the Linux box itself. If you want your gateway to be affected too, then put it on eth0. Furthermore, if one day you choose to add another LAN on eth2, shapping will also work for the latter without any additional configuration.

Regards,

Signature · 6 lines
Jeremie LE HEN aka TtZ/TataZ                          [email protected]
                                                                 [email protected]
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#8 lore raw

Re: [LARTC] newbie question

In reply to suresh

thanks

eth1 i guess..can I do shapping/scheduling on my LAN based on subnet ?.

|--subnet 10kbit
ISP---eth0-eth1---LAN---subnet 20kbit
|--subnet 15kbit

can htb or any tc do that for me..and how can i know my actual ceiling b/w traffic at eth1, so i can set it ass parent ? i have a 10/100 ethernet.

cheers
.:NewBie:.

Quoted 6 lines · jeremie le-hen
Quoted 5 lines

in this schema in what device i should implement shapping (htb)

ISP-----eth0 -eth1----LAN

Quoted 9 lines

If you implement your shaping/scheduling on eth1, then your LAN will be affected, but not the Linux box itself. If you want your gateway to be affected too, then put it on eth0. Furthermore, if one day you choose to add another LAN on eth2, shapping will also work for the latter without any additional configuration.

Regards,

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

#9 lore raw

[LARTC] newbie question

In reply to suresh

hi All.
this my script for shapping with htb, to shapping my network subnet

ISP--eth--eth1---lan with 4 subnet

cat /etc/shorewall/tcstart
#!/bin/bash
/sbin/tc qdisc add dev eth1 root handle 1: htb default 20 /sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 2mbit ceil 2mbit /sbin/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:11 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:12 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:13 htb rate 512kbps ceil 2mbit
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.0.0/24 flowid 1:10
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.32.0/24 flowid 1:11
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.64.0/24 flowid 1:12
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.128.0/24 flowid 1:13

/sbin/tc qdisc sh
qdisc htb 1: dev eth1 r2q 10 default 20 direct_packets_stat 0

when i test with iperf from 172.16.0.227 /usr/local/bin/iperf -c 172.16.0.226
------------------------------------------------------------
Client connecting to 172.16.0.226, TCP port 5001
TCP window size: 32.5 KByte (default)
------------------------------------------------------------
[ 5] local 172.16.0.228 port 49192 connected with 172.16.0.226 port 5001
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.0 sec 111 MBytes 92.8 Mbits/sec

i dont see bandwith limited that i excpected... did my step correct..or i did something stupid..(again)

cheers
.:NeWBie:.

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

#10 lore raw

Re: [LARTC] newbie question

In reply to suresh
Quoted 40 lines · Muhammad Reza

hi All.
this my script for shapping with htb, to shapping my network subnet

ISP--eth--eth1---lan with 4 subnet

cat /etc/shorewall/tcstart
#!/bin/bash
/sbin/tc qdisc add dev eth1 root handle 1: htb default 20 /sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 2mbit ceil 2mbit /sbin/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:11 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:12 htb rate 512kbps ceil 2mbit
/sbin/tc class add dev eth1 parent 1:1 classid 1:13 htb rate 512kbps ceil 2mbit
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.0.0/24 flowid 1:10
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.32.0/24 flowid 1:11
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.64.0/24 flowid 1:12
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 172.16.128.0/24 flowid 1:13

/sbin/tc qdisc sh
qdisc htb 1: dev eth1 r2q 10 default 20 direct_packets_stat 0

when i test with iperf from 172.16.0.227 /usr/local/bin/iperf -c 172.16.0.226
------------------------------------------------------------
Client connecting to 172.16.0.226, TCP port 5001
TCP window size: 32.5 KByte (default)
------------------------------------------------------------
[ 5] local 172.16.0.228 port 49192 connected with 172.16.0.226 port 5001
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.0 sec 111 MBytes 92.8 Mbits/sec

Quoted 2 lines

i dont see bandwith limited that i excpected... did my step correct..or i did something stupid..(again)

You are mixing bytes and bites. 512kbps is 512kiobyte/s and 2mbit is 2megabit/s. So 512kbps = 512 * 8 = 4mbit/s. It's still not 92.8 Mbit/sec.

Can you also post the output of
tc -s -d class show dev eth0

For more info about htb and the tests I did, see www.docum.org.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net

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

Hi all,

I am new to this mailing list.My doubt is Is it possible to mark QOS bits in IP header using tc? I marked using iptables.

Thanks in advance,
Aravind.

Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more.

#12 lore raw
In reply to suresh

Aravind,

: I am new to this mailing list. My doubt is Is it possible to mark QOS : bits in IP header using tc? I marked using iptables.

I saw your post on linux-diffserv as well. I wonder if you have yet found Leonardo Balliache's pages on using DiffServ with Linux. [0] With all good luck, this will be the jumpstart you need.

If not, try Werner Almesberger's slightly denser papers. [1]

-Martin

[0] http://opalsoft.net/qos/DS.htm
[1] http://www.almesberger.net/cv/papers.html

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/