# How to configure Dummynet in bridge mode?



## haozhong (Mar 13, 2010)

Hi,

I have been using Dummynet (on FreeBSD 5.2) as WAN simulator for years until I upgraded my system to 8.0 this week. And I noticed this command doesn't seem to work anymore - "*ipfw add pipe 1 ip from any to any bridged*". I did some search online, and am wondering if I should create two pipes, one for inbound and one for outbound. Could someone please confirm? Thanks much!

H


----------



## jailed (Mar 14, 2010)

I'm using FreeBSD 8, ipfw, dummynet and bridge too.

/boot/loader.conf

```
if_bridge_load="YES"
dummynet_load="YES"
```

Configure bridge in rc.conf


```
ipfw -q add pipe 1 ip from any to any
```
is enough. No need to add "bridged"

To limit bw,

```
ipfw pipe 1 config bw 1024Kbit/s
```

One pipe is enough. If you want to configure both inbound and outbound with different values you must create two.

"any to any" will set for both inbound and outbound with same value.

If you want to separate;


```
ipfw -q add pipe 1 ip from me to any # for upload. you can also replace "me" with an IP address or network
ipfw -q add pipe 2 ip from any to me # download
ipfw pipe 1 config bw 1024Kbit/s # can upload with 1024Kbit/s
ipfw pipe 2 config bw 128Kbit/s # can download with 128Kbit/s
```


----------



## haozhong (Mar 16, 2010)

As soon as I added [CMD="ipfw add pipe 1 ip from any to any"][/CMD], it stopped traffic from going through the bridge.

Here is my ifconfig result:


```
fxp0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
    ether 00:0e:0c:7f:2c:70
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
    ether 00:11:25:25:f7:93
    inet 192.168.48.34 netmask 0xfffffc00 broadcast 192.168.51.255
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4 
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 3e:65:1b:3b:13:a0
    id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
    maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
    root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
    member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 2 priority 128 path cost 2000000
    member: fxp0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 200000
```

and there is my "ipfw show" result:


```
00100    36    2256 allow ip from any to any via lo0
00200     0       0 deny ip from any to 127.0.0.0/8
00300     0       0 deny ip from 127.0.0.0/8 to any
00400    67   21525 pipe 1 ip from any to any
65000 18628 4139224 allow ip from any to any
65535     0       0 deny ip from any to any
```

Am I missing something?

Really appreciate your help!


----------



## haozhong (Mar 16, 2010)

Sorry, I meant as soon as I added


```
ipfw add pipe 1 ip from any to any
```


----------



## haozhong (Mar 16, 2010)

Never mind, I forgot to add 
	
	



```
net.link.bridge.ipfw=1[code] in [FILE]/etc/sysctl.conf[/FILE].
```


----------



## haozhong (Mar 16, 2010)

Thank you for your help!


----------



## bsd-newbie (Apr 8, 2011)

haozhong said:
			
		

> Sorry, I meant as soon as I added
> 
> 
> ```
> ...



I have the same problem and setting 
	
	



```
net.link.bridge.ipfw=1
```
 in sysctl.conf didn't help. 

Any suggestion?


----------

