在兩台switch都設定了這一行:
spanning tree mode rapid pvst
還不錯,大概斷線75秒就起來了。
在兩台switch都設定了這一行:
spanning tree mode rapid pvst
還不錯,大概斷線75秒就起來了。
之前用console無法連Pi3,baud rate調9600是亂碼,調115200什麼都出不來。一直以為是console線壞了。
但同一條線接Pi2,設定baud rate 115200又正常。
今天有空查了一下,原來是RPI3新增藍牙,造成後續一堆排擠效應的關係。
裝了Raspberry Pi OS,從gui介面開啟serial port (serial console)之後比較了一下config的差異,發現只要編輯/boot/config.txt
找到
[all]
新增下面這行 (當然還有其它解決方法但我懶得去查)
enable_uart=1
再重開Pi3,console又可以用115200快樂操作了。
1、Too few arguments to function
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function TABLE::__construct(), 0 passed in /home/www/OM/class/class.table.php on line
10638 and exactly 1 expected in /home/www/OM/class/class.table.php:14
原因是PHP7比較嚴謹(我猜的),所以即使是空值也要給個null
public function __construct($var_cond) => $var_cond=null
大批修改如下:
vi
%s/$var_cond)/$var_cond=null)/g
2、mysql_xxx to mysqli_xxx
所有mysql開頭的函式請改為mysqli開頭。但有兩個要特別注意的:
mysqli_query($sql, $conn); => mysqli_query($conn,$sql);
mysql_select_db('OM',$conn); => mysqli_select_db($conn,'OM');
這兩個mysql函式的順序跟mysqli相反,記得要調整。
3、PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
這個很明顯,改一下就好了。但callback似乎有比較多眉角,如果要做到沒有info或warning的話,要再調整一下。
4、PHP Deprecated: __autoload() is deprecated, use spl_autoload_register() instead
這個也是改一下就好了
5、ereg及split相關函式
ereg() 可以用 preg_match() 替代
ereg_replace() 可以用 preg_replace() 替代
eregi() 用 preg_match() i 引數替代
eregi_replace() 用 preg_replace() i 引數替代
split() 用 preg_split() 替代
spliti() 用 preg_split() 模式 ‘i’ 替代
split -> explode
split -> 因為語法有用到regular expression要改用preg_split
6、iconv()要用mb_convert_encoding取代
7、PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
Replace
public function TSStatus($host, $queryPort)
with
public function __construct($host, $queryPort)剩下的是環境問題:
1、php-fpm的log在/var/log/php-fpm/www-error,第一次用php-fpm的我不曉得。
2、Mariadb (MySQL)的錯誤訊息:Field `s_symptom` doesn‘t have a default value
要修改設定檔:
cd /etc/my.cnf.d
vi mariadb-server.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
3、mysqlimport最後要加上--local
https://linuxhint.com/install_tftp_server_centos7/
搞了一整天,結果是OS bug...
簡單的來說 換了RHEL8之後tftp一直不能傳,看fw會有異常的unreachable - admin prohibited filter
disable firewalld就會好,但總不能一直這樣吧....
3.106310 wan1 -- 192.168.26.26.23814 -> 192.168..100.33.69: udp 26
3.114525 wan1 -- 192.168..100.33.43341 -> 192.168.26.26.23814: udp 4
3.114943 wan1 -- 192.168.26.26 -> 192.168..100.33: icmp: host 192.168.26.26 unreachable - admin prohibited filter
8.105289 wan1 -- 192.168.26.26.23814 -> 192.168..100.33.69: udp 26
8.113544 wan1 -- 192.168..100.33.43342 -> 192.168.26.26.23814: udp 4
8.113931 wan1 -- 192.168.26.26 -> 192.168..100.33: icmp: host 192.168.26.26 unreachable - admin prohibited filter
怎麼改規則,怎麼加port都沒有效的...
/bin/firewall-cmd --permanent --zone public --add-service tftp-client
firewall-cmd --reload
sudo firewall-cmd --permanent --add-port=69/udp
sudo firewall-cmd --zone=public --add-service=tftp --permanent
firewall-cmd --reload
今天把ssh key重新產出了。結果一堆程式不能跑,查了很久才想到,在用ssh2.php登入設備時,id_rsa及id_rsa.pub(這個檔應該不用,但懶得試了)也會用到。
因此如果重新把ssh key產生時,記得把這兩隻key也放到程式的目錄中。
ssh免密碼認證應該算是基本功了。但我的新機器就是沒有辦法免密碼認證。
明明用其它帳號都正常,但就是我自己的帳號不行。
所以簡單講一下怎麼查:
1、先把firewall開好
sudo firewall-cmd --zone=public --permanent --add-port=2222/tcp
sudo firewall-cmd --reload
2、在server上開ssh debug
/usr/sbin/sshd -d -p 2222
3、從client去登入
ssh -p 2222 user@host
4、觀察debug:
debug1: trying public key file /home/klting/.ssh/authorized_keys debug1: fd 10 clearing O_NONBLOCK Authentication refused: bad ownership or modes for directory /home/klting
看的出來是/home/klting這個目錄的權限問題。
看了一下權限是750,可能是我之前測東西改到的,用chmod改回700就正常了。
5、記得關防火牆
sudo firewall-cmd --zone=public --permanent --remove-port=2222/tcp
sudo firewall-cmd --reload
最後確認一下目前防火牆開哪些port,確認有關成功
firewall-cmd --list-all
在使用Fortigate防火牆的時候,有時候需要長時間的錄封包。但使用的是低階的設備(例如FG80C),它本身GUI沒有側錄的功能,該怎麼處理呢?
很簡單,搭配一些linux指令就能處理了。
要安裝的套件是screen。指令及操作方式如下:
先開啟screen:
screen
登入防火牆,並且將輸出畫面同時顯示在螢幕上及另存在192.168.1.2.log這個檔案中。
ssh -l admin 192.168.1.2 | tee 192.168.1.2.log
開始側錄:
diagnose sniffer packet any 'host 192.168.1.1 and icmp' 6 0
開始側錄後,離開screen。
ctrl + a 後,再按下 d 鍵(detach)
把錄好的檔案,轉成wireshark格式。fgt2eth.pl是原廠提供的檔案,網路上找一下就有。
./fgt2eth.pl -in 192.168.1.2.log -out ay.cap
需確認事項:
1、ping一下192.168.1.1,確認192.168.1.2.log會長大 (確認寫檔成功)
2、丟在背景執行,過很長的時間後再ping一下,看檔案有沒有改大,測試有沒有被踢掉 (確認timeout是否影響側錄)
測試完成要離開screen:
先找出它的工作環境:
screen -ls
再回去該工作環境:
screen -r 20451
再中止sniffer packet (ctrl+c),並離開防火牆即可。