Linuxアプリケーション開発ノート:linuxptpを配置して起動する(uuntu gPTP)

2656 ワード

参考文献:
http://linuxptp.sourceforge.net/
https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/servers/Configuring_PTP_Using_ptp 4 l/
https://blog.csdn.net/fhxy_xzw/articale/details/79303132
https://packages.ubuntu.com/xenial/s390x/linuxptp/filelist
 
1、linuxptpをインストールする
sudo apt-get install linuxptp
2、linuxptpソースをダウンロードする:
git clone git://git.code.sf.net/p/linuxptp/code linuxptp
cd linuxptp
cp configs/gPTP.cfg ./
vim gPTP.cfg
追加:
p2p_dst_mac		01:1B:19:00:00:00
変更:
neighborPropDelayThresh	80000
ptp_dst_mac		01:1B:19:00:00:00
 
3、README構成を参照する:
sudo vim /usr/share/doc/linuxptp/README.Debian
1.Default configration
The default configration can be found in/etc/linuxptp/ptp 4 l.com.This the default.cfg provided by the up strem source.
2.Systemd services
The service ptp 4 l invokes ptp 4 l on eth 0 by default.To adjust the parameters,follow these steps:
1.create a directory/etc/system/system/ptp 4 l.service.d
2.place a file with its name ending in.conf there
3.put these line s into the file、with the parameters adjused to your needs:
[Service]ExecStart=Execstart=/usr/sbin/ptp 4 l-f/etc/linuxptp/ptp 4 l.co.1 nf-i eth 0
参考例:
//home/amine/linuxptp/gPT.cfg
.1AS example configration containing those atributes which the defaults. See the file,default.cfg,for the the the of available options.啯[global]gmCapable        1 priority 1        248 priority 2        248 logAnnounceInterval    0 logSync Interval        -3 sync ReceiptTimeout    3 neigh borPropDelayThreth    80000 min_neighbor_propdelay    -20000000 assiume_twoステップ        1 path_トレイenaboled    1フォロワーup_info        1 transport Specific    0 x 1 ptp_dst_mac        01:1 B:19:00:00 p 2 p_dst_mac        01:1 B:19:00 network_トラック    L 2 delay_mechaism        P 2 P 
//etc/systemd/system/ptp 4 l.service.d/gPT.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/ptp4l -2 -f /home/amine/linuxptp/gPTP.cfg -i eth0.10 -i eth0.20 -i eth0.30 -i eth0.40 -i eth0.50 -i eth0.60 -i eth0.70 -i eth0.80 eth0.90 -i eth0.100 -i eth0.110 -i eth0.120 -i eth0.130 -i eth0.140 -i eth0.150 -i eth0.160 -i eth0.170 -i eth0.180 -q -l 6 -S
特別な説明:
私が設定したVLANカードが多いので、ptp 4 l.serviceの起動エラーを引き起こしました。修正しました。
/lib/systemd/system/ptp4l.service
の[ユニット]が増加しました
After=network.target
[Unit]
Description=Precision Time Protocol (PTP) service
Documentation=man:ptp4l
After=network.target