Page 1 of 1

marking by hostname

Posted: Mon May 09, 2016 4:48 pm
by tadpole
Hi all,
I was wondering if it is possible to mark traffic via the device hostname? I want to limit the amount of traffic that the devices with a hostname android* and *iphone* are allowed.
I seem to recall being able to use some form of wizardry with hostnames in the hotspot section
Is there maybe some way that it can be "sorted" to use a separate ip pool even?
Like with the lease script on handing out ip-pool2 addresses to devices matching the hostname?

Re: marking by hostname

Posted: Mon May 09, 2016 6:32 pm
by ZeroByte
I would say that the solution you want is going to require some scripting - I'm not a scripting guru, but perhaps Boen_Robot or one of the other script wizards here can chime in on any particulars....

In general, you'll need to make a lease script for the DHCP server configuration, and this script will check the hostname. If it matches, then perhaps add the client's new address to an IP address list.

Then construct your packet marking rules of the mangle table so that they get the special connection/packet marking rules you want based on the address being in the address list.

(or perhaps there's a way to set the particular queue type directly from the lease script - again, that's not my forte)

Although, I'd say that using hostnames definitely has holes - what if the user overrides the hostname?

Re: marking by hostname

Posted: Tue May 10, 2016 10:24 am
by tadpole
Hi ZeroByte,
Thanks for the feedback, i agree its not perfect but i really want to prevent phones from munching important bandwidth. I figured this way i could lower the priority of the people who haven't changed their device names and rescue some of it ;)

Ideally i would have the cleverness to setup a proxy that could cache the traffic for apps and updates but i think that is a whole other story. I do have a transparent proxy setup using squid but it doesnt play nice with the phone stuff, perhaps this is something best fixed using a well setup squid server?