Seyyapc
01-09-2006, 03:18 AM
Hello people I've found a problem where I need some help. where I see my problem has to be something like don't understand really the difference between my ip adress and my internal ip adress.
My situation:
I have two computers connected to a d-link 624 router, one on cable the other on wireless.
Both go to internet from the router.
Internet (256kbps)
|
Router
| |
192.168.0.10 - 192.168.0.11
On my pc (192.168.0.10) I've dns-cache(pdnsd), samba and proxy(squid) servers for my pc and the other. Making my pc the gatway the configuration on level software is something like this.
Internet (256kbps)
|
Router
|
192.168.0.10 (linux)
|
192.168.0.11 (XP)
Finally to correct some problems with bandwidth I set limits with squid, the problem is that the other pc is not always connected so I don't use the total bandwidth when only my pc is online because the limits. Reading some info I finally make this script to take control of the bandwidth
tc qdisc add dev eth0 root handle 1: htb default 20
tc class add dev eth0 parent 1: classid 1:1 htb rate 256kbps ceil 256kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 128kbps ceil 256kbps
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 128kbps ceil 256kbps prio 1
tc qdisc add dev eth0 parent 1:10 handle 10: sfq
tc qdisc add dev eth0 parent 1:20 handle 20: sfq
iptables -A FORWARD -s 192.168.0.10 -t mangle -j MARK --set-mark 1
iptables -A FORWARD -s 192.168.0.11 -t mangle -j MARK --set-mark 2
tc filter add dev eth0 protocol ip parent 1: handle 1 fw classid 1:10
tc filter add dev eth0 protocol ip parent 1: handle 2 fw classid 1:20
In teory This code it's suppose to make my internet connection balanced for the two machines, the two will always have 128kbps for use, but if the other pc itÅ› not using the internet then will have all the bandwith available .
The code works but only on the second PC (192.168.0.11) operations from my pc(192.168.010) wich must go on the class 1:10 didn't work because it uses the class 1:1. I know it didn't work because my pc is the server but I suppose it has to be a way to control shapping the bandwith on the server or making some corrections on the iptables code.
What are looking to make is a balanced internet connection, so when my father don't use the computer i have all the bandwith or when i'm using giFT and my father wants to use the www it has bandwidth available.
I suppose a home network don't need these servers or traffic shapping but I want to learn, so I know how to use the tools that linux has to offer.
My situation:
I have two computers connected to a d-link 624 router, one on cable the other on wireless.
Both go to internet from the router.
Internet (256kbps)
|
Router
| |
192.168.0.10 - 192.168.0.11
On my pc (192.168.0.10) I've dns-cache(pdnsd), samba and proxy(squid) servers for my pc and the other. Making my pc the gatway the configuration on level software is something like this.
Internet (256kbps)
|
Router
|
192.168.0.10 (linux)
|
192.168.0.11 (XP)
Finally to correct some problems with bandwidth I set limits with squid, the problem is that the other pc is not always connected so I don't use the total bandwidth when only my pc is online because the limits. Reading some info I finally make this script to take control of the bandwidth
tc qdisc add dev eth0 root handle 1: htb default 20
tc class add dev eth0 parent 1: classid 1:1 htb rate 256kbps ceil 256kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 128kbps ceil 256kbps
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 128kbps ceil 256kbps prio 1
tc qdisc add dev eth0 parent 1:10 handle 10: sfq
tc qdisc add dev eth0 parent 1:20 handle 20: sfq
iptables -A FORWARD -s 192.168.0.10 -t mangle -j MARK --set-mark 1
iptables -A FORWARD -s 192.168.0.11 -t mangle -j MARK --set-mark 2
tc filter add dev eth0 protocol ip parent 1: handle 1 fw classid 1:10
tc filter add dev eth0 protocol ip parent 1: handle 2 fw classid 1:20
In teory This code it's suppose to make my internet connection balanced for the two machines, the two will always have 128kbps for use, but if the other pc itÅ› not using the internet then will have all the bandwith available .
The code works but only on the second PC (192.168.0.11) operations from my pc(192.168.010) wich must go on the class 1:10 didn't work because it uses the class 1:1. I know it didn't work because my pc is the server but I suppose it has to be a way to control shapping the bandwith on the server or making some corrections on the iptables code.
What are looking to make is a balanced internet connection, so when my father don't use the computer i have all the bandwith or when i'm using giFT and my father wants to use the www it has bandwidth available.
I suppose a home network don't need these servers or traffic shapping but I want to learn, so I know how to use the tools that linux has to offer.