For this reason I decided to gather in one place relevant knowledge and to share with you my configuration.
IMPORTANT
Before you read the following guide przeczytaj:
- http://wiki.openwrt.org/doc/uci/network/switch
- http://wiki.openwrt.org/doc/howto/udp_multicast
- http://www.computerhilfen.de/hilfen-22-389919-0.html
Diagram - my assumption
From supplier I have:
- Internet - Nietagowany (VLAN5, Eth0.5, Wan)
- IPTV - tagging VLAN1 (VLAN1, eth0.1, wan_iptv)
- Management - tagging VLAN6 (VLAN6, eth0.6, wan_adm)
What I wanted to achieve:
- Internet ports 2.3 and WIFI - for computers
- TV on port 1 (multicast) - IPTV decoder (SetTopBox)
- TV on port 2.3 and WIFI (tcp) - for computers
- everything on the port 4 - for a neighbor (to on your router did the same as me)
1. Know VLANs in your network
- I used sniffer with http://networksecuritytoolkit.org
- Windows hard sniff VLAN, because often drivers for network cards do not support cit. http://wiki.wireshark.org/CaptureSetup/VLAN#Windows
Windows has no built- in support mechanisms for VLANs. There are not separate physical and VLAN interfaces you can capture from, or unless a specialized driver That adds dry support is present.
So it is best to use for this some linux
2. Configure VLANs on the router
For me, the high VLANs so if you must remember to set the use enable_vlan4k ' 1 ' in the file / etc / config / network
- Code:
config 'switch'
option 'name' 'rtl8366rb'
option 'reset' '1'
option 'enable_vlan' '1'
option 'enable_vlan4k' '1'
/etc/config/network
- Code:
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
#VLAN6
config 'interface' 'wan_adm'
option 'ifname' 'eth0.6'
option 'proto' 'dhcp'
option 'metric' '10'
#VLAN1
config 'interface' 'wan_iptv'
option 'ifname' 'eth0.1'
option 'proto' 'dhcp'
option 'metric' '20'
#VLAN5
config 'interface' 'wan'
option 'ifname' 'eth0.5'
option 'proto' 'dhcp'
config 'interface' 'lan'
option 'ifname' 'eth0.2'
option 'type' 'bridge'
option 'proto' 'static'
option 'netmask' '255.255.255.0'
option 'ipaddr' '192.168.1.1'
config 'switch'
option 'name' 'rtl8366rb'
option 'reset' '1'
option 'enable_vlan' '1'
option 'enable_vlan4k' '1'
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '6'
option 'ports' '0t 4t 5t'
#na port 0 (WAN - wan_adm) - comes tagged VLAN6,
#na port 4 - tagged out
#na port 5 (Procek) - comes tagged
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '1'
option 'ports' '0t 1 4t 5t'
#na port 0 (WAN - wan_iptv) - comes tagged VLAN1,
#na port 4 - tagged out
#na port 1 - out nietagowany (connection of the decoder)
#na port 5 (Procek) - comes tagged
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '5'
option 'ports' '0 4 5t'
#na port 0 (WAN - wan) - comes nietagowany,
#na port 4 - out nietagowany
#na port 5 (Procek) - comes tagged
config 'switch_vlan'
option 'device' 'rtl8366rb'
option 'vlan' '2'
option 'ports' '2 3 5t'
#na port 2 and 3 - out nietagowany
#na port 5 (Procek) - comes tagged VLAN2
config 'route'
option 'interface' 'wan_iptv'
option 'target' '224.0.0.0'
option 'netmask' '240.0.0.0'
we add to the default configuration of / etc / config / dhcp
- Code:
dhcp config wan_iptv
option 'interface' 'wan_iptv'
option 'ignore' '1'
config dhcp wan_adm
option 'interface' 'wan_adm'
option 'ignore' '1'
we add to the default configuration of / etc / config / firewall
- Code:
#definicja for wan_iptv with nat
config 'zone'
option 'name' 'wan_iptv'
option 'input' 'REJECT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
option 'masq' '1'
option 'mtu_fix' 1 '
option 'network' 'wan_iptv'
config 'forwarding'
option 'src' 'lan'
option '' 'wan_iptv'
# ----- PINGI the wan_iptv
config 'rule'
option 'name' 'Allow-DHCP-Renew-wan_iptv'
option 'src' 'wan_iptv'
option 'proto' 'udp'
option 'dest_port' '68'
option 'target' 'ACCEPT'
option 'family' 'ipv4'
config 'rule'
option 'name' 'Allow-Ping-wan_iptv'
option 'src' 'wan_iptv'
option 'proto' 'icmp'
option 'icmp_type' 'echo-request'
option 'family' 'ipv4'
option 'target' 'ACCEPT'
# ----- Udpxy
config 'rule'
option 'src' 'wan_iptv'
option 'proto' 'igmp'
option 'target' 'ACCEPT'
config 'rule'
option 'src' 'wan_iptv'
option 'proto' 'udp'
option 'dest_x' '224.0.0.0/4'
option 'target' 'ACCEPT'
3. Check VLANs in your network
When such a configuration, the result
- Code:
route -n
It should look something like this (of course, IP addresses and VLANs are specific to your network):
- Code:
root@OpenWrt:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
0.0.0.0 213.154.24.0 255.255.255.0 U 0 0 0 eth0.5
0.0.0.0 172.18.15.0 255.255.254.0 U 0 0 0 eth0.1
0.0.0.0 172.14.18.0 255.255.252.0 U 0 0 0 eth0.6
224.0.0.0 240.0.0.0 0.0.0.0 U 0 0 0 eth0.1
0.0.0.0 213.154.24.1 0.0.0.0 UG 0 0 0 eth0.5
Results of swconfig should look something like this:
- Code:
root@OpenWrt:~# swconfig dev rtl8366rb vlan 1 show
VLAN 1:
info: VLAN 1: Ports: '0t14t5t', members=003d, untag=000c, fid=0
in: 0
ports: 0t 1 4t 5t
root@OpenWrt:~# swconfig dev rtl8366rb vlan 2 show
VLAN 2:
info: VLAN 2: Ports: '235t', members=0022, untag=0002, fid=0
in: 0
ports: 2 3 5t
root@OpenWrt:~# swconfig dev rtl8366rb vlan 5 show
VLAN 5:
info: VLAN 5: Ports: '045t', members=0031, untag=0011, fid=0
in: 0
ports: 0 4 5t
root@OpenWrt:~# swconfig dev rtl8366rb vlan 6 show
VLAN 6:
info: VLAN 6: Ports: '0t4t5t', members=0031, untag=0000, fid=0
in: 0
ports: 0t 4t 5t
This is where IPTV should work now.
IPTV WIFI
Use the package udpxy (multicast to unicast)
Installation package
- Code:
opkg install udpxy
Creating a startup script (if there is)
- Code:
touch /etc/init.d/udpxy
chmod a+x /etc/init.d/udpxy
the contents of the script /etc/init.d/udpxy where 192.168.1.1 is the IP address of the router on the LAN
- Code:
#!/bin/sh /etc/rc.common
# Copyright (C) 2010 OpenWrt.org
START=99
STOP=10
# 192.168.1.1 - IP address of the router's LAN
# 8080 - the port on which to operate
IGMP_OPTS="-p 8080 -a 192.168.1.1"
IGMP_BIN="/usr/bin/udpxy"
PID_F="/var/run/udpxy.pid"
start() {
echo "Starting udpxy"
start-stop-daemon -S -x $IGMP_BIN -p $PID_F -b -m -- $IGMP_OPTS
}
stop() {
echo "Stopping udpxy"
start-stop-daemon -K -x $IGMP_BIN -p $PID_F -q
}
We turn on the service:
- Code:
/etc/init.d/udpxy enable
We run the service:
- Code:
/etc/init.d/udpxy start
When you start please check the log does not appear in the following problems, we read log:
- Code:
logread
Unfortunately for us, there can appear:
- Code:
udpxy[55201]: read_buf: read: Resource temporarily unavailable
Then you have to fight with the configuration
- the firewall (eg. Closed ports)
- network (eg. Bad VLANs, no routes)
Generally udpxy it is working problems through WIFI up 802.11 g.
If everything is in order at this
- Code:
http://192.168.1.1:8080/status
You will be an information page.
If the cable , it is possible to play in VLC (where 239.64.64.58:6000 is an address transmission)
- Code:
udp://@239.64.64.58:6000
For WIFI stream video to VLC we get:
- Code:
http://192.168.1.1:8080/udp/239.64.64.58:6000
Saving IPTV streams
- Code:
udpxrec -T -c 239.64.64.58:6000 /tmp/streamdump.mpg
Package igmpproxy
On the Attitude Adjustment 12.09 you can successfully use a package igmpproxy when the function 'IGMP snooping' (see below)
installation package
- Code:
opkg install igmpproxy
We turn on the service:
- Code:
/etc/init.d/igmpproxy enable
Pzykładowa configuration / etc / config / igmpproxy
- Code:
config igmpproxy
option quickleave 1
config phyint
option network wan
option direction upstream
list altnet 192.168.65.0/24
config phyint
option network lan
option direction downstream
We run the service:
- Code:
/etc/init.d/igmpproxy start
In this configuration, it is important to correctly set the parameter "Altnet".
If you do not know how to set the parameter "Altnet" search log something like: "Warn: The source address 192.168.65.166 for group 233.32.240.222, is not in any valid net for upstream VIF " In this way, you know the source of the multicast address by your provider.
IGMP snooping i multicast forwarding
IGMP snooping is not supported in older versions (eg. Backfire 10.03.1), and this may cause flooding of packets (ang. "IGMP multicast flooding")
At 12.09 AA function it is by default OFF
(worth following http://wiki.openwrt.org/doc/howto/udp_multicast because previously it was different)
Installation:
- Code:
opkg update
opkg install kmod-bridge
For efficient operation of IPTV benefiting of igmpproxy or udpxy should:
- enable IGMP snooping in the interface lan
- Code:
config interface lan
option type bridge
option igmp_snooping 1
...
- Turn off multicast snooping
- Code:
echo "1" > /sys/devices/virtual/net/br-lan/bridge/multicast_snooping
Nguồn: http://eko.one.pl/forum/viewtopic.php?id=3400