Wednesday, 29 June 2016

BREXIT and the end of the world





I've never been a fan of the EU...I've followed it's rise over the years and I haven't been impressed at its total disconnect between the people it represents and the bureaucrats who run it...The council for instance is unaccountable to the public, they are appointed by a nod....

It has all the trappings and appearance of democracy but unfortunately falls completely short of it because of that disconnect between the council and the public...

They can push through laws with no comeback from the public they control...they have effectively removed the ability of the people to remove them and that removal of self determination is a dangerous line to cross ....because it's been done in the past any dictatorship has that key element the inability to remove them. It always ends badly.

The last tool democracy has is the will of the people to ignore it is dangerous....

The ill will towards the EU has been steadily rising for years, their dream of total integration and fiscal union is total madness it will never work in a collection of European states which have such disparate economies....which is why the likes of Greece is now in debt to the EU to tune of 300 billion Euros with another 86 billion agreed....They will take generations to just break even with the mounting debt levels they have.

I'm not going to go into a deep financial rant it's pointless there is plenty out there to find out how bad this is I suggest you research to truly horrify yourself.

The ECB is buying the EU debt at an alarming rate it's simply not sustainable it's like the EU is a person with an inability to see how bad it's finances really are ....so it applies for another credit card to pay off the last one which has hit it's limit...

Deutchesbank is also in serious trouble the EU is a slow motion car crash and people do not see it.

Remain voters seem to think leave voters have ruined their lives....what they don't realise yet is that we've mitigated a disaster waiting to happen that will be an enormous crash protecting the UK by voting to leave the EU...

There has been so much political posturing over this referendum...initially allowed by Cameron to stave off the tory voters switching to UKIP... where Cameron thought it would also heal his own parties deep divisions over the EU..

Alas that didn't happen and like most of our ivory tower politicians who are totally disconnected from the public... he and his advisors had no idea how strong the anti EU feeling was running...which is why he thought it would be safe to call a referendum....but he was playing Russian roulette with a single barrelled shotgun.....

The majority of the remain voters I've spoken to seem to have rose tinted glasses on, they've believed the hype and the lies piled on thick like plaster on a wall. Whilst the EU gives the impression of a democratic organisation they are not, instead of thinking we've lost something, they should start thinking we've actually got rid of a nasty creeping infection...The information is out there you just have to go looking for it....The deeper you dig the more horrifying it becomes, and I fear the majority of remain voters simply cherry picked the good points and didn't register the bad ....or worse still didn't know about them.

 Time will tell what will happen.

But Sterling is rising, shares are increasing and the doom and gloom predicted is simply not happening.

Either way democracy has spoken and our country should pull together with each other to make a success
of the UK in its new direction after 40 years of capitulation to the EU.... Change isn't always bad....We have opened up our markets to the rest of the world, things can only get better and they will.








Monday, 2 May 2016

Broadcasting Terrestrial TV across your LAN

First off you need a bit of background into how this all works, TV transmitters have transponders which multiplex their digital channels onto the transponder, they are then transmitted to you and I over the air.

So one frequency can contain many different channels, in the old days of analogue this meant that one frequency meant one channel, but digital TV has opened up the radio spectrum to many more channels by splitting channels into different streams and transmitting them on one frequency.

This makes it ideal for computers to deal with because its just a digital stream and it can be split from the signal and displayed on appropriate hardware.

The hard bit is converting a digital tv signal into a signal that can be broadcast over wires or wifi.


There are two ways to do this, you can use Multicast traffic or Unicast traffic, they each have their plus points and minus points....


Multicast
Multicast traffic is one continuous stream of data broadcast on the multicast IP's all of the time.

IP Multicast Address Ranges and Uses
224.0.0.0 - 224.0.0.255
Reserved for special “well-known” multicast addresses.
224.0.1.0 - 238.255.255.255
Globally-scoped (Internet-wide) multicast addresses.
239.0.0.0 - 239.255.255.255
Administratively-scoped (local) multicast addresses.

The advantages of multicast broadcasting is reduction in bandwidth usage, as its only ever
one stream of data and the clients "join" the stream.

One of the disadvantages of Multicast are that if your router or switch doesn't support IGMP sniffing you will flood your lan with multicast traffic, older HP switches are prone to this behaviour, newer HP switches can be configured to behave themselves instead of bringing your network to a grinding halt.

So to sum up broadcasting and entire transponder of say the BBC channels wouldn't eat up much bandwidth at all. 

Unicast
This is a one to one connection to the TV server/streaming server and each unique connection adds to the bandwidth consumed.

now a standard definition broadcast will consume in its raw broadcast format around 3 - 4 megabits/sec and a HD broadcast up to 8 or more megabits/sec.

Now without doing the mathematics you will have realised that you'll soon flood a 100Mbit lan link with stream data. Which is true but there are things you can do to reduce this to make it very workable in a LAN.

There are many different ways you can broadcast your TV on your lan but I've found these two the simplest and most reliable.

How to do it 



first off there is Mumudvb which is available under Linux for quite a few different distributions, including the Raspberry Pi

http://www.mumudvb.net/


this extremely small piece of software will allow you to multicast your TV channels using a very simple configuration file and using very cheap USB adapters, bear in mind you will need a separate tuner for each frequency/transponder you want to broadcast, ours here in Wales where I live is Preseli and it has 6 transponders.

698000000 khz
738000000 khz
770000000 khz
730000000 khz
786000000 khz

as of 2nd May 2016


This simple configuration file below I used to broadcast the 786Mhz digital tv transponder across my network, some 31 channels in all, on a single usb NOVA-T stick

#For DVB-T if the bandwith is 8MHz you don't have to set other parameters
card=0
freq=786
port_http=9091 <---anything already="" font="" isn="" like="" t="" taken="" that="" you="">
timeout_no_diff=1000
dvr_thread
rewrite_pat=1
rtp_header=1
check_status=1
pol=h
srate=27500
autoconfiguration=full
autoconf_radios=1
autoconf_pid_update=0
autoconf_ip4_header=239.10
multicast_ttl=2
multicast_auto_join=1
unicast=1
ip_http=192.168.1.175
sap=1  <-- broadcast="" can="" font="" pick="" so="" streams="" that="" them="" up="" vlc="" your="">

sap_default_group=MCAST


the items in bold are the things you'll need to change, obviously the frequency of the transmitter and the tuner card(s) you have, if you've only got one it will be 0 (zero) two and it will be 1 (one) etc... and the IP address of the computer which has the tuner card fitted. 

I wouldn't advise you setup six tuners on a home network unless your router understands multicasting (BT homehubs seem to)  otherwise you'll effectively kill your network for any other use......as all transponder frequencies pushed to individual multicast addresses would be well in excess of 80Mbit/sec, which is fine if you have 1Gbit connection but not 100Mbit....

a saner setup for home use would be TVheadend, which has a very simple web based front end which is setup very easily and with the newer versions above 4.1 you can even stream your tv in your browser .

https://tvheadend.org/projects/tvheadend

and there are clients out there for Android and iPhone/IOS, with TVheadend and one tuner you can tune to one transponder at a time, but that transponder will make all the channels on that transponder available, so say if one person in your house was watching BBC1, you could have another client watching BBC2 or any other BBC channel at the same time, but if one of the users decided they wanted to watch ITV it would kick off the other client tuned to BBC, so if you need all channels available at all times, you'd need more than one tuner, if you are never going to have more than three people using the tv streamer then you'd only need three tuners, as the likelihood is three transponders would serve the majority of the channels at any one time, you could possibly get away with two tuners, but you may get fights occurring with clients who want channels on other transponders. 


If you are intent on broadcasting the entire content of your local TV transmitter across your lan (as I am in the school I work in) then TVHeadend is the sanest approach, as it also allows DVR recordings which Mumudvb doesn't.

You'll need at least 6 tuners preferably PCI not USB such as the excellent TBS 6205 and a gigabit lan on the backbone of your lan, fortunately we have that where I work, remember with unicast you add to the bandwidth requirements with every client you serve.... so if 30 people each watched a channel it would be 30 x 3 megabits = 90 Megabits/sec if you upped that to 60 clients it would be 180 Mbits/sec, similarly if 30 people wanted to watch BBC1 simultaneously it would still be 3 - 4 megabits each, under multicast it would only EVER be 3 -4 Megabits regardless of how many clients you had, so for scalability multicast is the way to go.

You can serve multi channels with just one tuner lets just say for arguments sake the BBC transponder and that will allow as many clients per channel as your pc and lan can stand, watching or listening to any BBC broadcast.

You will need a very beefy computer to run TVheadend where that many people are going to stream from, I've specified an i7 top of the range 6 core beast with 3 TB of disk space and 16GB ram, because I'm going to transcode the video and audio streams into a lower quality and hence lower bandwidth, which takes CPU power.

I've managed to produce a perfectly respectable picture and sound consuming 400 - 500 kbit/sec on the VP8 video codec, which is fine for Windows 7 on Google Chrome .....So that is 1 Mbit/sec per two clients ......

Small tricks like only encoding one sound stream instead of stereo cuts it down a fair amount and I've found that setting the maximum bandwidth for sound at around 32kbit's in mono was fine, if you really needed stereo then 64kbit/sec was the bare minimum, without noticing poor sound.

I've calculated that at maximum bandwidth on our lan a PC of that calibre could in theory stream to 300 + clients at the same time, realistically the client count will be much lower in the low 50s I should imagine, but you do need the extra grunt if a lot of people hit the server at the same time.

I've yet to implement this but my tests so far have shown that it works very well. So once I've successfully implemented this I will come back and post my configs and setup and some real world figures to back up my theory......


Watch this space !!!


Update

I've since implemented this configuration and successfully streamed to over 75 clients and the CPU barely got above 25% across all cores, and was streaming to all of those clients at 1Mbit so the Gigabit backbone peaked at around 65 - 70Mbits and with a theoretical limit of 125Mbits on a Gigabit switch.... I suspect it would support at least 100 clients comfortably........


If anyone requires help on implementing this solution please leave a comment and I'll get back to you with the configuration and streaming profiles 


















Friday, 3 July 2015


For those of us in computing Zero-config or Bonjour or Avahi is the bane of our lives, especially when trying to shoe horn it into an enterprise network because it will not travel across vlans,  Bonjour packets will not pass a Layer 3 boundary. What's needed to make Bonjour work across subnets is a proxy and here is a free open source working alternative......

There are many off the shelf products out there which do the job but you usually have to pay a fortune for the privilege.....

Well I've just implemented an Avahi reflector using nothing more than a cheap laptop running Debian 8 (Jessie) and a network cable and made it work over 20 vlans

All you need is a network port on a switch (ours are Cisco 3750's) which can give you a 8021q trunk connection, a pc, it doesn't have to be high powered ours is running on an Atom cpu on 2GB of ram, it doesn't actually need that much it currently sits in 351MB of memory running at full tilt, it barely tickles the cpu's .....

So install your headless debian server (there are many how to's out there)

load vlan and modprobe it into the kernel

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
8021q

setup your vlans on eth0 

vconfig add eth0 50  # or whatever it's called

repeat and rinse until you've added them all

go edit your /etc/network/interfaces

and put in each vlan with a fixed IP address in the form of

 iface eth0.50 inet static
  address 10.11.50.9
  netmask 255.255.255.0
  gateway 10.11.50.1
auto eth0.60
iface eth0.60 inet static
  address 10.11.60.9
  netmask 255.255.255.0
auto eth0.120
iface eth0.120 inet static
  address 10.11.120.9
  netmask 255.255.255.0

My 50 vlan has a gateway so that it can get updates and be ssh'd into remotely
but it's not necessary it will work without a gateway

so include all of the vlans you want to rebroadcast the bonjour packets on, make sure that you aren't using an IP address already assigned on the vlan in question, best way to avoid this is to put an exclusion in your DHCP server in each vlan and use the same last number on each vlan 

In my case I've assigned 10.11.XXX.9 to all of my fingers in the vlans so to speak

then edit avahi-daemon.conf in /etc/avahi and turn on 

[reflector]
enable-reflector=yes
reflect-ipv=no

you may have a problem with avahi stopping because of a unicast local problem but you can work around that by editing crontab for root and simply putting this line in 

* * * * * rm -rf /var/run/avahi-daemon/disabled-for-unicast-local
0 * * * * service avahi-daemon restart

the first line stops the avahi-daemon shutting down because of a .unicast local problem and restarts it every hour, and keeps deleting the file if it reappears.....

go back into the terminal and check with ifconfig that all your vlans are sending and receiving data

eth0.233  Link encap:Ethernet  HWaddr c8:9c:xx:xx:xx:xx  
          inet addr:10.11.233.9  Bcast:10.11.233.255  Mask:255.255.255.0
          inet6 addr: fe80::ca9c:dcff:fe84:cb9f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1338 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17959 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:567767 (554.4 KiB)  TX bytes:4442622 (4.2 MiB)

eth0.240  Link encap:Ethernet  HWaddr c8:xx:xx:xx:xx:xx  
          inet addr:10.11.240.9  Bcast:10.11.240.255  Mask:255.255.255.0
          inet6 addr: fe80::ca9c:dcff:fe84:cb9f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16884 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2635 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5503572 (5.2 MiB)  TX bytes:1168738 (1.1 MiB)

and bobs yer uncle....

fire up your ipad and you'll see everything on every vlan, it also allows you to see all of your Apple TV's over every vlan and wifi and even allows you to connect your Apple TV's to ethernet cables rather than relying on wifi connections. You'll also see all of your VNC and SFTP and anything else broadcast on mdns 

I've also managed to get airprint working on non airprint printers, using linux CUPS ...if you're interested in implementing it drop me an email, it will work with ANY printer.


admin@draco.co.uk


Enjoy !!!!