Linux VLAN Priority CoS config
11/24/2015, 16:54 - Network
With Ubuntu 15.10
apt-get install vlan

/etc/udev/rules.d/70-persistent-net.rules

# USB device 0x:0x (ax88179_178a)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:05:1b:a3:12:ce", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth10"


/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto p2p1
#iface p2p1 inet dhcp
#
# Change biosdevname back to eth
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
#
# address 192.168.7.200
# netmask 255.255.0.0
# gateway 192.168.1.201
#
address 172.22.10.254
netmask 255.255.255.0
gateway 172.22.10.1
#
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
txq 30000
#
# Wireless Client
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless_mode managed
wireless_txpower auto
#
pre-up wpa_supplicant -B -Dwext -iwlan0 \
-c/etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant
#
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
#
# Wireless AP
#auto wlan0
#iface wlan0 inet static
# hostapd /etc/hostapd/hostapd.conf
# wireless_txpower auto
# address 172.22.2.254
# netmask 255.255.255.0
#
#
auto eth10
allow-hotplug eth10
txq 10000
#
auto eth10.10
iface eth10.10 inet static
#
vlan-egress-map 0:3 4:3 2:1
vlan-ingress-map 0:5 1:6 2:7
address 10.10.10.3
netmask 255.255.255.0
#
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
txq 5000
#
auto eth10.20
iface eth10.20 inet static
#
vlan-egress-map 0:3 4:3 2:1
vlan-ingress-map 0:5 1:6 2:7
address 10.10.20.3
netmask 255.255.255.0
#
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
txq 5000
#
auto eth10.30
iface eth10.30 inet static
#
vlan-egress-map 0:3 4:3 2:1
vlan-ingress-map 0:5 1:6 2:7
address 10.10.30.3
netmask 255.255.255.0
#
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4
txq 5000
#

/etc/network/if-up.d/vlan

#!/bin/sh

# Most of this stuff is to enable vlans

case "$IFACE" in
# Ignore any alias (#272891) which uses <interface>:<alabel>
*:*)
exit 0
;;
vlan0*)
vconfig set_name_type VLAN_PLUS_VID
VLANID=`echo $IFACE|sed "s/vlan0*//"`
;;
vlan*)
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
VLANID=`echo $IFACE|sed "s/vlan0*//"`
;;
eth*.0*|bond*.0*|wlan*.0*|em*.0*|p[0-9]*.0*)
vconfig set_name_type DEV_PLUS_VID
VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.0*//g;s/bond[0-9][0-9]*\.0*//g;s/wlan[0-9][0-9]*\.0*//g;s/em[0-9][0-9]*\.0*//g;s/p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\.0*//g"`
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/;s/\(bond[0-9][0-9]*\)\..*/\1/;s/\(wlan[0-9][0-9]*\)\..*/\1/;s/\(em[0-9][0-9]*\)\..*/\1/;s/\(p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\)\..*/\1/"`
;;
eth*.*|bond*.*|wlan*.*|em*.*|p[0-9]*.*)
vconfig set_name_type DEV_PLUS_VID_NO_PAD
VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.0*//g;s/bond[0-9][0-9]*\.0*//g;s/wlan[0-9][0-9]*\.0*//g;s/em[0-9][0-9]*\.0*//g;s/p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\.0*//g"`
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/;s/\(bond[0-9][0-9]*\)\..*/\1/;s/\(wlan[0-9][0-9]*\)\..*/\1/;s/\(em[0-9][0-9]*\)\..*/\1/;s/\(p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\)\..*/\1/"`
;;
*.0*)
# Silently ignore interfaces which we do not (know how to) support
[ -z "$IF_VLAN_RAW_DEVICE" ] && exit 0
vconfig set_name_type DEV_PLUS_VID
VLANID=`echo $IFACE|sed "s/[^.]*\.0*//g"`
;;
*.*)
# Silently ignore interfaces which we do not (know how to) support
[ -z "$IF_VLAN_RAW_DEVICE" ] && exit 0
vconfig set_name_type DEV_PLUS_VID_NO_PAD
VLANID=`echo $IFACE|sed "s/[^.]*\.0*//g"`
;;

*)
exit 0
;;
esac

if [ -n "$IF_VLAN_RAW_DEVICE" ] && [ -d /sys/class/net/$IFACE ]; then
if [ ! -x /sbin/vconfig ]; then
exit 0
fi
if [ -n "$IF_VLAN_EGRESS_MAP" ]; then
for i in $IF_VLAN_EGRESS_MAP ; do
vconfig set_egress_map $IFACE `echo $i|cut -d: -f1` `echo $i|cut -d: -f2`
done
fi
if [ -n "$IF_VLAN_INGRESS_MAP" ]; then
for i in $IF_VLAN_INGRESS_MAP ; do
vconfig set_ingress_map $IFACE `echo $i|cut -d: -f1` `echo $i|cut -d: -f2`
done
fi
fi
#


/etc/network/if-up.d/ifqueue

#!/bin/sh
if [ -d "/sys/class/net/$IFACE" ]; then
TXQ=`expr $IF_TXQ + 0`
if [ -n "$IF_TXQ" ] && [ "$TXQ" -gt 0 ]; then
# ifconfig $IFACE txqueuelen $TXQ
ip link set txqueuelen $TXQ dev $IFACE
fi
fi
#


ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 30000
link/ether 08:62:66:c7:ba:b0 brd ff:ff:ff:ff:ff:ff
3: eth10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10000
link/ether 00:05:1b:a3:12:ce brd ff:ff:ff:ff:ff:ff
4: eth10.10@eth10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 5000
link/ether 00:05:1b:a3:12:ce brd ff:ff:ff:ff:ff:ff
5: eth10.20@eth10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 5000
link/ether 00:05:1b:a3:12:ce brd ff:ff:ff:ff:ff:ff
6: eth10.30@eth10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 5000
link/ether 00:05:1b:a3:12:ce brd ff:ff:ff:ff:ff:ff


/proc/net/vlan/config

VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth10.10 | 10 | eth10
eth10.20 | 20 | eth10
eth10.30 | 30 | eth10


/proc/net/vlan/eth10.10 - eth10.30

eth10.10 VID: 10 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 73
total bytes received 24464
Broadcast/Multicast Rcvd 0

total frames transmitted 131
total bytes transmitted 58775
Device: eth10
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:1 7:2
EGRESS priority mappings: 0:3 2:1 4:3

eth10.20 VID: 20 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 0
total bytes received 0
Broadcast/Multicast Rcvd 0

total frames transmitted 45
total bytes transmitted 7462
Device: eth10
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:1 7:2
EGRESS priority mappings: 0:3 2:1 4:3

eth10.30 VID: 30 REORDER_HDR: 1 dev->priv_flags: 1
total frames received 5
total bytes received 4152
Broadcast/Multicast Rcvd 0

total frames transmitted 50
total bytes transmitted 11656
Device: eth10
INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:1 7:2
EGRESS priority mappings: 0:3 2:1 4:3

發表回應 發表回應 ( 1665預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 679 )

OS X 10.11
10/15/2015, 00:33 - Apple


發表回應 發表回應 ( 990預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 2.9 / 656 )

NTP
05/06/2015, 20:59 - Network
看來 ntp.nasa.gov 不能用了,換到 pool.ntp.org 好了。
發表回應 發表回應 ( 2602預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 696 )

netsurf-fb SDL_Init Unable open mouse problem solved
03/12/2015, 15:00 - Open Source
netsurf-fb 'SDL_Init()' Unable open mouse problem solved
Reference URL
發表回應 發表回應 ( 2154預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 705 )

WebkitGTK patch for directFB without X11 in Linux
03/05/2015, 16:59 - Open Source
This is not a new patch, copy someone patch to OS X, but test successful.


--- Source/WebCore/plugins/PluginView.h.orig 2015-03-05 12:59:54.367967198 +0800
+++ Source/WebCore/plugins/PluginView.h 2015-03-05 13:01:34.659459208 +0800
@@ -378,7 +378,8 @@
void setNPWindowIfNeeded();
#endif

-#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+//#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
bool m_hasPendingGeometryChange;
Pixmap m_drawable;
Visual* m_visual;

--- Source/WebCore/plugins/PluginView.cpp.orig 2015-03-05 12:57:54.328586254 +0800
+++ Source/WebCore/plugins/PluginView.cpp 2015-03-05 13:02:50.131097591 +0800
@@ -839,7 +839,8 @@
#if defined(XP_MACOSX)
, m_contextRef(0)
#endif
-#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+//#if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
, m_hasPendingGeometryChange(true)
, m_drawable(0)
, m_visual(0)

--- Source/WebCore/bridge/npruntime_internal.h.orig 2015-03-05 13:04:23.290670731 +0800
+++ Source/WebCore/bridge/npruntime_internal.h 2015-03-05 13:05:01.154499696 +0800
@@ -29,7 +29,8 @@
#include "npfunctions.h"
#include "npruntime.h"

-#if defined(MOZ_X11)
+//#if defined(MOZ_X11)
+#if PLATFORM(X11)
#include <X11/Xresource.h>

#undef None

發表回應 發表回應 ( 1275預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 653 )

Upgrade OS X Server's ClamAV
02/05/2015, 12:43 - Apple
Reference to Updating ClamAv on OS X Server >= 10.5.6

Here is my script to auto build
clamav_renew.sh

#!/bin/bash
#
VERSION=0.98.6
if [ -e clamav-${VERSION}.tar.gz ]; then
rm -fr clamav-${VERSION}.tar.gz
fi
#
if [ -d clamav-${VERSION} ]; then
rm -fr clamav-${VERSION}
fi
#
wget http://sourceforge.net/projects/clamav/files/clamav/${VERSION}/clamav-${VERSION}.tar.gz
#
tar -zxvf clamav-${VERSION}.tar.gz
#
cd clamav-${VERSION}
#
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/private/etc \
--enable-bigstack --enable-static \
--with-user=_clamav --with-group=_clamav \
--with-dbdir=/var/clamav --datadir=/var/clamav
#
make
#
make check
#
SELECT=""
IFS=''
#
echo "Press Y to install ClamAV, version " ${VERSION}
read -s -n 1 SELECT
#
if [[ "$SELECT" =~ [yY] ]]; then
make install
#
echo "Reload clamav"
if [ -e clamav_reload.sh ]; then
./clamav_reload.sh
fi
#
fi
#


clamav_reload.sh

#!/bin/bash
#
# refresh database
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.freshclam.plist
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/org.clamav.freshclam.plist
# restart clamd
sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/org.clamav.clamd.plist
sudo /bin/launchctl load -w /System/Library/LaunchDaemons/org.clamav.clamd.plist
#a reload amavisd
sudo /bin/launchctl unload /System/Library/LaunchDaemons/org.amavis.amavisd.plist
sudo /bin/launchctl load /System/Library/LaunchDaemons/org.amavis.amavisd.plist
#

發表回應 發表回應 ( 1318預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 680 )

Goto OS X 10.10.2
02/04/2015, 17:54 - Apple

發表回應 發表回應 ( 1264預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 663 )

中美網路大戰
01/27/2015, 15:54 - 今天

IPViking截下來的圖,
顯示美國正在被網路攻擊中,所以Facebook及很多的網路服務都出問題連不上,
而最大量的攻擊量來自美國本土及中國。
從美國本土根本不奇怪,因為美國有最大量的公開IP address,而連網的電腦數量也最多,但從中國來的攻擊就有點好玩了。
因為中國是網路管制的國家,平時一些網路服務都是在監控中,若是有敏感疑慮的根本就出不了中國。
但這次的攻擊有一半是從中國發出的,若不是中國有意發動,那就表示中國的防火長城根本就是笑話,而若是中國有意攻擊的話,那也真的太直接了吧。
攻擊目標最多的是telnet port 23及3389。
還好上週用了fail2ban將有問題的網路access都列入黑名單了。
發表回應 發表回應 ( 959預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 2.9 / 438 )

iPhone6 Plus訂單
11/14/2014, 10:15 - Apple
幫忙在Apple Store TW(不是我要用的)訂了一部iPhone6 Plus 64G 銀,需要3-4星期才會送到。


發表回應 發表回應 ( 6792預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 481 )

政府官員不懂,那就開放資料,讓專業的來吧。
09/10/2014, 10:38 - 生活
進出貨物,在稅務機關有發票,因為要收稅金。
進出口海關和稅務機關有貨單和稅單,因為要收稅金以及管制貨物進出口。

廠商生產出來的產品,有要求要注明內容物及含量。
而原料一但進入生產後,只會少不會多,這可以從內容物含量反算出來,進多少貨可以生產多少產品。
除非從原料到產品都是從地上、地下挖出來、長出來的,或是無中生有、天上掉下來的,不然一定有資料可以找出流向!
而向生產飼料的工廠進貨原料,經過製造,出貨變成人吃的產品,這不會看不出來吧!

廠商的生產配方要保密?那難道配方用料就不用明白標示在包裝上嗎?
即要明白標示,何來的密秘呢?除非標示不實吧。
怕稅務資料被利用?分析這些資料用不到單價、稅金、報價的資料,當然不需要放進來。

若政府收集好這些資料,還要廠商自我管理申報嗎?
依靠商人的良心?這算是笑話吧,都已經是商人了,怎麼會有良心這種換不到錢的東西呢。
資料都有了,那還無法預先找出問題嗎?
其實在政府內部這些資料全部都有啊,只是沒有人可以合併及分析,只要交插分析一下就可以找出奇怪的東西及流向了不是嗎?
政府各部門間的資料根本沒有互通,各自為政,才會無法防止無良商人,在生產的產品中放進不該放的東西,而且發生問題之後,還找不出來。

當官的聽過大數據分析嗎?
收集資料和分析資料交給電腦自動做,只要一點點人力做檢查和維護,
大數據當然不是用什麼Excel就可以(也許Excel超級高高高高手可以啦...XD),
但也沒有需要到多厲害的機器和軟體才可以,
因為進出貨、進出口的料料並不需要即時到時分秒的等級,
以星期、也許月份、也許季就可以了。
不過最簡單的方法就是開放資料,給無聊但有心的人來做,而不是將資料掌握在無心的人手上。

政府官員不懂,那就開放資料,讓專業的來吧。
發表回應 發表回應 ( 1367預覽 )   |  [ 0 引用 ]   |  permalink   |   ( 3 / 460 )


<前一頁 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 下一頁> 最後>>