Linux应用程序开发笔记:配置linuxptp开机启动(ubuntu gPTP)

   日期:2020-05-01     浏览:297    评论:0    
核心提示:参考文献:http://linuxptp.sourceforge.net/https://docs.运维

 参考文献:

http://linuxptp.sourceforge.net/

https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/servers/Configuring_PTP_Using_ptp4l/

https://blog.csdn.net/fhxy_xzw/article/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 configuration

The default configuration can be found in /etc/linuxptp/ptp4l.conf.
This is the default.cfg provided by the upstream source.

2. Systemd services

The service ptp4l invokes ptp4l on eth0 by default. To adjust the
parameters, follow these steps:

1. create a directory /etc/systemd/system/ptp4l.service.d

2. place a file with its name ending in .conf there

3. put these lines into the file, with the parameters adjusted to your needs:

[Service]
ExecStart=
ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0

参考示例:

/home/amine/linuxptp/gPTP.cfg

#
# 802.1AS example configuration containing those attributes which
# differ from the defaults.  See the file, default.cfg, for the
# complete list of available options.
#
[global]
gmCapable        1
priority1        248
priority2        248
logAnnounceInterval    0
logSyncInterval        -3
syncReceiptTimeout    3
neighborPropDelayThresh    80000
min_neighbor_prop_delay    -20000000
assume_two_step        1
path_trace_enabled    1
follow_up_info        1
transportSpecific    0x1
ptp_dst_mac        01:1B:19:00:00:00
p2p_dst_mac        01:1B:19:00:00:00
network_transport    L2
delay_mechanism        P2P
 

/etc/systemd/system/ptp4l.service.d/gPTP.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网卡比较多,导致ptp4l.service启动错误,我修改了

/lib/systemd/system/ptp4l.service

的 [Unit] 增加

After=network.target
[Unit]
Description=Precision Time Protocol (PTP) service
Documentation=man:ptp4l
After=network.target

 

 

 

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服