Emulating DummyNet



  • I was thinking about a way to emulate dummynet features. I dont know if this works, i need to test it.

    My idea was to use loopback devices… using bridge make two lo devices bridged, then :

    # mark packets comming down from the net so as to block the loopback effect
    pass in on lo1 tag CommingDown
    # block looping back packets
    block out quick on lo1 tagged CommingDown
    pass out on lo1 tagged ! CommingDown
    
    # mark packets comming up from the lan so as to block the loopback effect
    pass in on lo2 tag GoingUp
    # block looping back packets
    block out quick on lo2 tagged GoingUp
    pass out on lo2 tagged ! GoingUp
    
    

    then use altq on these devices

    altq on lo2 bandwidth xxMb queues (User1Down, User2Down, ...)
    queue User1Down .... configure this user bandwidth down
    ... bla bla
    altq on lo1 bandwidth yyMb queues (User1Up, User2Up, ...)
    queue User1Up ... configure this user bandwidth up
    
    

    at the real devices should be some rules :

    pass in on landevice from lannetwork .... route to (lo2, lo2ip)
    pass in on wandevice from ! lannetwork .... route to (lo1, lo1ip)
    
    

    do you think this would work ?

    Edit : altq rules were inverted…



  • I don't think ALTQ behave well on loopback since loopback is not treated as a real network interface.

    Though you might play with it but take in consideration playing with tbrsize(tbrconbfig) parameter to not have performance issues.


Log in to reply