Recently in Network Category

MAC-telnet

user-pic
Vote 0 Votes

MAC access 是 RouterOS 的私有協定,它可以用 MAC address 連線,即使用設備端沒有設定 IP
抓封包就可以得知,它的原理是使用 UDP 廣播的方式運作,連線端及設備端都是使用 UDP 廣播來溝通,
這也是它可以不用 IP 也能連線的原因,前提是需位於同一個 L2 層
MAC-Telnet 這個是比較舊的版本了,這個版本已經無法連線 >=6.43 版的 RouterOS
版本 >=6.43 的 RouterOS 都是使用 hash 過的 password
6.43 changelog:
*) user - all passwords are now hashed and encrypted, plaintext passwords are kept for downgrade
(will be removed in later upgrades);
裡面有:
Server mactelnetd
Client mactelnet
MikroTik Neighbor Discovery protocol mndp
protocol.h 可看到使用兩個 Port,一個 5678 用來 discovery, 20561 用來溝通
#define MT_MACTELNET_PORT 20561
#define MT_MNDP_PORT 5678
mactelnetd 需配合一個帳號密碼檔 /usr/local/etc/mactelnetd.users,
格式是純文字 username:password
系統帳號也需要有一樣的帳號才能正常登入

Get RouterOS latest version

user-pic
Vote 0 Votes

stable
curl https://upgrade.mikrotik.com/routeros/LATEST.6

long term
curl https://upgrade.mikrotik.com/routeros/LATEST.6fix

testing
curl https://upgrade.mikrotik.com/routeros/LATEST.6rc

development
curl https://upgrade.mikrotik.com/routeros/LATEST.7

輸出有兩個欄位
6.44.3 1556023023
第一個欄位是版本, 第二個欄位應該是 build time (seconds since 1970-01-01 00:00:00 UTC)
目前 development 無資料 (404 Not Found)

因為 IPv6 沒有 NAT, 在 RouterBoard 設置 IPv6 基本防火牆條例是必要的, 否則外部可以使用 IPv6 直連內部的電腦
以下是 PPPoE 環境的 IPv6 基本條例

/ipv6 firewall filter
add action=accept chain=forward connection-state=established in-interface=pppoe-out1 # 容許已建立的連線
add action=accept chain=forward connection-state=related in-interface=pppoe-out1 # 容許關聯連線
add action=accept chain=forward in-interface=pppoe-out1 protocol=icmpv6 # 容許外面 ping 內部電腦
add action=accept chain=forward dst-port=22 in-interface=pppoe-out1 protocol=tcp # 容許外面連內部的 Port 22, 不需要可以移除
add action=accept chain=input in-interface=pppoe-out1 protocol=icmpv6 # 容許外面 ping RouterBoard 本身
add action=accept chain=input comment="DHCPv6 client" dst-port=546 protocol=udp # 容許 DHCPv6 client, 一定要加, 不然會拿不到 IP
add action=drop chain=forward in-interface=pppoe-out1 # DROP 其餘轉發封包
add action=drop chain=input in-interface=pppoe-out1 # DROP 其餘對 RouterBoard 本身的封包, 經由 pppoe-out1 進來
add action=drop chain=input in-interface=ether1 # DROP 其餘對 RouterBoard 本身的封包, 經由 ether1 進來
# 因為 pppoe-out1 是經由 ether1 撥的, 也加上去

這邊的 chain=forward 是指轉發封包, 經過 RouterBoard
chain=input 是指對 RouterBoard 本身
上面的範例 IPv6 外對內就只有 ping 及 Port 22 有通, 內對外不受限制

Block LINE server addresses

user-pic
Vote 0 Votes

To block LINE, deny following addresses
103.2.28.0/22
119.235.224.0/20
147.92.128.0/17
203.104.128.0/19

Shadowsocks server

user-pic
Vote 0 Votes

pip install shadowsocks

create /etc/shadowsocks.json
{
"server":"my_server_ip",
"server_port":8388,
"local_port":1080,
"password":"your_password",
"timeout":600,
"method":"aes-256-cfb"
}

ssserver -c /etc/shadowsocks.json -d start

Ireasoning MIB browser

user-pic
Vote 0 Votes

HiNet Dr.Speed Analysis

user-pic
Vote 0 Votes

抓封包看 HiNet Dr.Speed 測試流程, 使用版本是 0.98 Beta
測試前動作
1. 抓 Test Code 及服務契約條款 GET http://speed2.hinet.net/app/get_testid2.aspx?APP_Platform=windows&App_ver=0.98
2. 抓測試前注意事項(HTML格式) GET http://speed2.hinet.net/app/info.aspx
3. 去 whois 查詢 IP, 取得服務抓供者(ISP), 最後測試結果會顯示
組態載入中
1. 每次連會回傳一串亂數, 不清楚這個目的 GET http://speed2.hinet.net/app/get_ip.aspx
2. 回傳版本及 IP GET http://speed2.hinet.net/app/get_content2.aspx?App_ver=0.98&Isp=HINET-NET&wan_ipv4=IP&wan_ipv6=null
3. 初始化1 GET http://speed2.hinet.net/initialize.aspx
4. 初始化2 GET http://speed2.hinet.net/initialize_vspdf.aspx
下行測試
1. 用 ftp/ftp 帳密連到 ftp.speed.hinet.net 開三線 RETR test_2048m.zip, 約 10 秒後送出 QUIT and ABOR (中止命令)
2. 中間會有幾次 GET http://speed2.hinet.net/keeptrack.aspx
上行測試
1. 開二線 STOR yyyymmddhhmmssxxx.txt (e.g. 2017021822573659.txt), 約 10 秒後送出 QUIT
2. 中間會有幾次 GET http://speed2.hinet.net/keeptrack.aspx
測試後動作
1. 回傳結果 POST http://speed2.hinet.net/app/report.aspx
2. 廣告代理網頁 GET http://speed2.hinet.net/app/ad_agent2.aspx

Net-SNMP IFTABLE_CACHE_TIMEOUT

user-pic
Vote 0 Votes

IFTABLE_CACHE_TIMEOUT control how frequent update ifTable counter.
Net-SNMP v5.4,v5.5 IFTABLE_CACHE_TIMEOUT 15
Net-SNMP v5.6,v5.7 IFTABLE_CACHE_TIMEOUT 3
Newer version have shorter cache timeout, but if you want to monitor real-time traffic by second, 3 seconds still useless.

To change this value

Method 1:
snmpset -v2c -cpublic localhost .1.3.6.1.4.1.8072.1.5.3.1.2.1.3.6.1.2.1.2.2 i 1 # after snmpd start
Note: use override to set the value does NOT work.
ref. How to set the agent update or counter refresh interval on net-snmp

Method 2:
Get Net-SNMP source tar ball, change the value in agent/mibgroup/if-mib/ifTable/ifTable_data_access.h
./configure && make && make install

Enable Keepalived SNMP subsystem

user-pic
Vote 0 Votes

echo KEEPALIVED_OPTIONS=\"-D -x\" > /etc/sysconfig/keepalived
echo master agentx >> /etc/snmp/snmpd.conf
echo mibs +KEEPALIVED-MIB >> /etc/snmp/snmp.conf # load KEEPALIVED-MIB, the file must in /usr/share/snmp/mibs
service snmpd restart
service keepalived restart # must after restart snmpd

snmpwalk -v2c -cpuclic localhost KEEPALIVED-MIB:vrrp

ASNIP.net

user-pic
Vote 0 Votes

ASNIP.net 是 asnumbers.net 的新域名 (連到 asnumbers.net 會轉向到 asnip.net)
除了可以查 ASN 的資訊外
加了兩項新功能
ASN to IPs, 查詢某 ASN 的所有網段
IP to ASN, 查詢某 IP 對應的 ASN

About this Archive

This page is an archive of recent entries in the Network category.

My Program is the previous category.

News is the next category.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives