Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Feb 2004 01:43:44 +0100
From:      Bjorn Eikeland <bjorn@eikeland.info>
To:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   dummynet = local taffic > 100ms - help!
Message-ID:  <opr24pm6dnomdbx5@localhost>

next in thread | raw e-mail | index | archive | help
I think I've made a mess of my attempt to shape my traffic, the traffic
on my lan ip is getting delayed. (About 18ms idle and 100ms full load,
load is the same as for internet traffic)

Traffic to localhost and other lan hosts are not delayed, the delay only
occurs from my box to my ip.

I started with http://www.topfx.com/prioritizingackfreebsd.shtml as a
template for my traffic shaping and have extended it a bit:

DUMMYNET and HZ=10000 is in the kernel.

Any suggestions what can be causing this? (I've only got the one nic,
and use a adsl router for internett)

thanks,
Bjorn

#
# Traffic shaping rules
#

#
# Define some variables (or "constants" really)
#
echo Setting up variables
IPFW=ipfw
WAN_UL_CAP=18KByte/s
WAN_DL_CAP=180KByte/s
LAN_NET=10.0.0.0
LAN_CIDR=24
echo WAN UPLOAD		${WAN_UL_CAP}
echo WAN DOWNLOAD 	${WAN_DL_CAP}
echo LAN_NET		${LAN_NET}
echo LAN_MASK		${LAN_MASK}
echo LAN_CIDR		${LAN_CIDR}

#
# FLUSH old rules (< `echo y` answers yes)
#
echo Flushing rules
${IPFW} flush < `echo y`

#
# TRAFFIC SHAPING:
#
# Make packets exiting dummynet not continue down the chain
# If this is not enabled, then packets leaving an early
# queue might enter a later queue if the conditions for
# the later queue are met, which would be completely
# devastating to all the prioritizing we're doing
#
${IPFW} enable one_pass

#
# Lopback and local net traffic
#
${IPFW} pipe 1 config bw lo0
${IPFW} pipe 2 config bw fxp0
${IPFW} add pipe 1 all from localhost to localhost
${IPFW} add pipe 2 all from ${LAN_NET}/${LAN_CIDR} to 
${LAN_NET}/${LAN_CIDR}

#
# WAN Pipes
#
echo Setting up WAN Pipes
WAN_UL=3
WAN_DL=4
${IPFW} pipe $WAN_UL config bw $WAN_UL_CAP
${IPFW} pipe $WAN_DL config bw $WAN_DL_CAP

#
# WAN_UL queues
#
echo Setting up WAN_UL Queues
WAN_UL_HI=1
WAN_UL_M1=2
WAN_UL_M2=3
WAN_UL_LO=4
  # Define a high-priority queue
   ${IPFW} queue $WAN_UL_HI config pipe $WAN_UL weight 50

  # Define a medium-high-priority queues
   ${IPFW} queue $WAN_UL_M1 config pipe $WAN_UL weight 10
   ${IPFW} queue $WAN_UL_M2 config pipe $WAN_UL weight 5

  # Define a low-priority queue
   ${IPFW} queue $WAN_UL_LO config pipe $WAN_UL weight 1

#
#Assign WAN_UL traffic to queue's
#
echo Assigning WAN_UL traffic
  # HIGH PRIORITY
   # Assign outgoing empty/small ACK + ICMP packets to the high-priority 
queue:
    ${IPFW} add queue $WAN_UL_HI tcp from me to not ${LAN_NET}/${LAN_CIDR} 
tcpflags ack iplen 0-80
    ${IPFW} add queue $WAN_UL_HI icmp from me to not ${LAN_NET}/${LAN_CIDR}

  # MEDIUM PRIORITY
   # Outgoing DNS and SSH traffic to the medium-high-priority queue:
    ${IPFW} add queue $WAN_UL_M1 ip	from me to not ${LAN_NET}/${LAN_CIDR} 
domain
    ${IPFW} add queue $WAN_UL_M1 tcp from me to not ${LAN_NET}/${LAN_CIDR} 
ssh,telnet,login
   # Outgoing http requests - possibly file uploads & mails
    ${IPFW} add queue $WAN_UL_M2 tcp from me to not ${LAN_NET}/${LAN_CIDR} 
http,https,pop3,imap,smtp
   # Outgoing ftp-control
    ${IPFW} add queue $WAN_UL_M2 ip from me to not ${LAN_NET}/${LAN_CIDR} 
ftp
   # Add gaming traffic later

  # LOW PRIORITY
   # Assign all other outgoing traffic to the low-priority queue:
    ${IPFW} add queue $WAN_UL_LO all from me to not ${LAN_NET}/${LAN_CIDR}

#
# WAN_DL queues
#
echo Setting up WAN_DL Queues
WAN_DL_HI=5
WAN_DL_M1=6
WAN_DL_M2=7
WAN_DL_LO=8
  # Define a high-priority queue
   ${IPFW} queue $WAN_DL_HI config pipe $WAN_DL weight 50

  # Define a medium-high-priority queues
   ${IPFW} queue $WAN_DL_M1 config pipe $WAN_DL weight 10
   ${IPFW} queue $WAN_DL_M2 config pipe $WAN_DL weight 5

  # Define a low-priority queue
   ${IPFW} queue $WAN_DL_LO config pipe $WAN_DL weight 1

#
#Assign WAN_DL traffic to queue's
#
echo Assigning WAN_DL traffic
  # HIGH PRIORITY
   # Assign outgoing empty/small ACK + ICMP packets to the high-priority 
queue:
    ${IPFW} add queue $WAN_DL_HI tcp from not ${LAN_NET}/${LAN_CIDR} to me 
tcpflags ack iplen 0-80
    ${IPFW} add queue $WAN_DL_HI icmp from not ${LAN_NET}/${LAN_CIDR} to me

  # MEDIUM PRIORITY
   # Outgoing DNS and SSH traffic to the medium-high-priority queue:
    ${IPFW} add queue $WAN_DL_M1 ip	from not ${LAN_NET}/${LAN_CIDR} to me 
domain
    ${IPFW} add queue $WAN_DL_M1 tcp from not ${LAN_NET}/${LAN_CIDR} to me 
ssh,telnet,login
   # Outgoing http requests - possibly file uploads & mails
    ${IPFW} add queue $WAN_DL_M2 tcp from not ${LAN_NET}/${LAN_CIDR} to me 
http,https,pop3,imap,smtp
   # Outgoing ftp-control
    ${IPFW} add queue $WAN_DL_M2 ip from not ${LAN_NET}/${LAN_CIDR} to me 
ftp
   # Add gaming traffic later

  # LOW PRIORITY
   # Assign all other outgoing traffic to the low-priority queue:
    ${IPFW} add queue $WAN_DL_LO all from not ${LAN_NET}/${LAN_CIDR} to me



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opr24pm6dnomdbx5>