因为用的Archlinux,默认systemd启用,所以干脆用 systemd-networkd.service来管理DHCP获取ip地址,抛弃了[email protected],ip地址是配置成功了,但是坑爹的是原本可以用的vpn服务突然连接不上了,取消 systemd-networkd.service换回[email protected]之后,一切都顺畅了。 摸索了好久,发现原来如此坑爹。。。
官网上: http://www.freedesktop.org/software/systemd/man/systemd.network.html
里面有一句:
IPForward=
Configures IP forwarding for the network interface. If enabled incoming packets on the network interface will be forwarded to other interfaces according to the routing table. Takes either a boolean argument, or the values "ipv4" or "ipv6", which only enables IP forwarding for the specified address family. This controls the net.ipv4.conf.<interface>.forwarding and net.ipv6.conf.<interface>.forwarding sysctl options of the network interface (see ip-sysctl.txt for details about sysctl options). Defaults to "no".
Note: unless this option is turned on, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the net.ipv4.ip_forward and net.ipv4.ip_forward sysctl options. Also, if this option is enabled for at least one interface, the global options in the kernel are also enabled as necessary, to ensure IP forwarding can take place.
IPMasquerade=
Configures IP masquerading for the network interface. If enabled packets forwarded from the network interface will be appear as coming from the local host. Takes a boolean argument. Implies IPForward=yes. Defaults to "no".
特别是这句话:
Note: unless this option is turned on, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the net.ipv4.ip_forward and net.ipv4.ip_forward sysctl options.
也就是说,如果用systemd-networkd.service来配置ip地址,而且没有开启 IPForward=1 这个选项的话,ip转发就会失效(即使sysctl.conf里面配置了转发,systemd也会让它失效),也就意味着VPN能拨号,但是不能上网。
我真搞不明白,systemd到底要干什么。。。 原来的系统服务什么都被他给替代了。。。
另外有些程序需要系统获取ip地址之后才能够正常运行。。。 如果用systemd-networkd.service 配置网络,他是不管你ip地址有没有,就直接往下继续运行其他service,导致出问题。除非enable systemd-networkd-wait-online.service,而且还要给service特别设置
[Unit]
Requires=network-online.target
After=network-online.target
尤其影响的是[email protected] [email protected].
官网上: http://www.freedesktop.org/software/systemd/man/systemd.network.html
里面有一句:
IPForward=
Configures IP forwarding for the network interface. If enabled incoming packets on the network interface will be forwarded to other interfaces according to the routing table. Takes either a boolean argument, or the values "ipv4" or "ipv6", which only enables IP forwarding for the specified address family. This controls the net.ipv4.conf.<interface>.forwarding and net.ipv6.conf.<interface>.forwarding sysctl options of the network interface (see ip-sysctl.txt for details about sysctl options). Defaults to "no".
Note: unless this option is turned on, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the net.ipv4.ip_forward and net.ipv4.ip_forward sysctl options. Also, if this option is enabled for at least one interface, the global options in the kernel are also enabled as necessary, to ensure IP forwarding can take place.
IPMasquerade=
Configures IP masquerading for the network interface. If enabled packets forwarded from the network interface will be appear as coming from the local host. Takes a boolean argument. Implies IPForward=yes. Defaults to "no".
特别是这句话:
Note: unless this option is turned on, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the net.ipv4.ip_forward and net.ipv4.ip_forward sysctl options.
也就是说,如果用systemd-networkd.service来配置ip地址,而且没有开启 IPForward=1 这个选项的话,ip转发就会失效(即使sysctl.conf里面配置了转发,systemd也会让它失效),也就意味着VPN能拨号,但是不能上网。
我真搞不明白,systemd到底要干什么。。。 原来的系统服务什么都被他给替代了。。。
另外有些程序需要系统获取ip地址之后才能够正常运行。。。 如果用systemd-networkd.service 配置网络,他是不管你ip地址有没有,就直接往下继续运行其他service,导致出问题。除非enable systemd-networkd-wait-online.service,而且还要给service特别设置
[Unit]
Requires=network-online.target
After=network-online.target
尤其影响的是[email protected] [email protected].