V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
station
V2EX  ›  Linux

突然感觉好无奈,这个咋整? 让其先行一步

  •  
  •   station · 2015-08-13 13:10:27 +08:00 · 3476 次点击
    这是一个创建于 3194 天前的主题,其中的信息可能已经有所发展或是发生改变。
    试过多次就差那么几秒 , 蛋好疼....
    19 条回复    2015-08-16 09:06:02 +08:00
    imn1
        1
    imn1  
       2015-08-13 13:30:33 +08:00
    本来想回复让你自己按摩一下的,进来居然看到标题改了~

    dhcp比dnsmasq还慢?
    whatot
        2
    whatot  
       2015-08-13 13:40:44 +08:00
    After=network.target

    我的dnsmasq.service有这么一条,不知道你的为什么是这样??
    whatot
        3
    whatot  
       2015-08-13 13:43:33 +08:00
    添加一个依赖,应该就行了
    station
        4
    station  
    OP
       2015-08-13 13:52:53 +08:00
    @whatot 你这么一说,我查看了下更蛋疼

    station
        5
    station  
    OP
       2015-08-13 13:54:07 +08:00
    @imn1 从时间上看貌似是的
    whatot
        6
    whatot  
       2015-08-13 13:57:47 +08:00
    @station 你试试让dnsmasq在dhcp之后启动。。。。
    Starduster
        7
    Starduster  
       2015-08-13 15:31:27 +08:00
    写个脚本在开机之后 xx 秒再一遍跑 dnsmasq
    realpg
        8
    realpg  
       2015-08-13 21:40:39 +08:00
    改一下dnsmasq的init.d脚本 增加检测wlan0的IP 如果检测不到就sleep5
    station
        9
    station  
    OP
       2015-08-13 22:25:26 +08:00
    @realp 发行版本fedora,程序中没有...
    station
        10
    station  
    OP
       2015-08-14 08:01:37 +08:00
    @Starduster 总觉得这不是根本解决之道,肯定那里出问题了,亦或是bug ?
    station
        11
    station  
    OP
       2015-08-14 08:06:19 +08:00
    @whatot dhclient ?
    station
        12
    station  
    OP
       2015-08-14 08:31:37 +08:00
    @whatot 真是日了狗
    whatot
        13
    whatot  
       2015-08-14 11:38:54 +08:00
    @station 因为我用的是桌面系统,所以使用的是NetworkManager,NetworkManager管理了这一系列的启动,跟你的有点区别。但肯定的是dnsmasq启动太早了。

    $ systemctl status NetworkManager.service
    ● NetworkManager.service - Network Manager
    Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
    Active: active (running) since 五 2015-08-14 10:08:48 CST; 1h 27min ago
    Main PID: 555 (NetworkManager)
    CGroup: /system.slice/NetworkManager.service
    ├─ 555 /usr/bin/NetworkManager --no-daemon
    ├─2143 /usr/bin/dhclient -d -q -sf /usr/lib/networkmanager/nm-dhcp-helper -pf /var/run/dhclient-wlp3s0.pid -lf /var/lib/NetworkManager/dhclient-c7a9c963-908b-4cf4-91fe-81a2c810...
    └─2151 /usr/bin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --conf-file=/var...
    station
        14
    station  
    OP
       2015-08-14 12:27:00 +08:00
    @whatot 的确,好多after=network.target都比network启动早,我还找不到原因,实在不行只能重做系统了......
    HMSQQbA
        15
    HMSQQbA  
       2015-08-14 12:53:13 +08:00 via Android
    systemd真是蛋痛的玩意,常出此类问题。
    station
        16
    station  
    OP
       2015-08-14 13:53:42 +08:00
    @HMSQQbA 你也遇到了? 感觉bug一样
    HMSQQbA
        17
    HMSQQbA  
       2015-08-14 14:23:00 +08:00 via Android
    @station 不是你这个问题,但常遇到各种unit不能按规则触发。对systemd总体感觉不好。
    rwzsycwan
        18
    rwzsycwan  
       2015-08-15 00:29:59 +08:00
    debian 8 的dnsmasq.service:
    [Unit]
    Description=dnsmasq - A lightweight DHCP and caching DNS server
    Requires=network.target

    [Service]
    Type=forking
    PIDFile=/var/run/dnsmasq/dnsmasq.pid

    # Test the config file and refuse starting if it is not valid.
    ExecStartPre=/usr/sbin/dnsmasq --test

    # We run dnsmasq via the /etc/init.d/dnsmasq script which acts as a
    # wrapper picking up extra configuration files and then execs dnsmasq
    # itself, when called with the "systemd-exec" function.
    ExecStart=/etc/init.d/dnsmasq systemd-exec

    # The systemd-*-resolvconf functions configure (and deconfigure)
    # resolvconf to work with the dnsmasq DNS server. They're called liek
    # this to get correct error handling (ie don't start-resolvconf if the
    # dnsmasq daemon fails to start.
    ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
    ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf


    ExecReload=/bin/kill -HUP $MAINPID

    [Install]
    WantedBy=multi-user.target
    station
        19
    station  
    OP
       2015-08-16 09:06:02 +08:00
    @rwzsycwan service文件其实没什么差别 fedora 21 但没有/etc/init.d/dnsmasq这个文件
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2698 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 04:24 · PVG 12:24 · LAX 21:24 · JFK 00:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.