无法ping l2tp vpn连接上的其他本地ips,得到:ping:sendmsg:没有这样的设备

我已经使用xl2tp设置了一个l2tp客户端连接到一个l2tp vpn服务器。 服务器连接要求将连接设置为不带ipsec。 所以我build立了一个基本的xl2tp连接。 连接似乎工作,我得到一个IP地址从VPN服务器,这是可见的,当我运行ifconfig。 不过,我不能ping任何networking上我已经连接到networking上,有一个特定的IPnetworking上我需要连接到:10.10.251.32,但是当我尝试我得到这个错误:“ping:sendmsg:没有这样的设备”。 我尝试使用ping命令:ping -I ppp0 10.10.251.32。 我已经尝试从其他机器连接到vpn,我分配的IP地址例如:10.10.2.163,10.10.2.120或10.10.2.114 10.10.2.xxx子网中,

  1. 这是我的xl2tpd.conf:

    [global] access control = no auth file = /etc/ppp/chap-secrets debug avp = no debug network = no debug packet = no debug state = no debug tunnel = no [lac vpn-connection] lns = xx.xx.32.43 redial = yes redial timeout = 5 require chap = yes require authentication = yes ppp debug = no pppoptfile = /etc/ppp/options.l2tpd require pap = no autodial = yes name = thename 
  2. 这里是我的:options.l2tpd

     ipcp-accept-local ipcp-accept-remote refuse-eap require-mschap-v2 noccp noauth idle 1800 mtu 1410 mru 1410 defaultroute usepeerdns debug lock connect-delay 5000 name xxxxxx password xxxxx 
  3. 我知道连接得到了,因为我得到一个PPPoE接口和一个IP地址:

     ppp0 Link encap:Point-to-Point Protocol inet addr:10.10.2.115 PtP:xx.xx.32.43 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1410 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:98 (98.0 B) TX bytes:110 (110.0 B) 
  4. 我需要命中的服务器的IP地址是:10.10.251.32,当我尝试使用特定于该接口的ping命令对其进行ping时:

     ping -I ppp0 10.10.251.32 

我最终得到这个错误:ping:sendmsg:没有这样的设备

  1. 也许这是我连接到vpn同时使用多个客户端客户端的某种子网问题,并得到了IP,如10.10.2.120,10.10.2.114,并ping从每一个客户端到另一个问题:ping:sendmsg:无此设备。 与所有客户端连接,ifconfig返回正确的IP地址。

pipe理其他networking的人发誓,这些IP地址已启动并正在运行。 我不知道如何进行..原谅一个总的Linux新手..

  1. 这里是ip ro show的输出ip ro show

     default via xx.31.32.1 dev eth0 xx.xx.32.43 dev ppp0 proto kernel scope link src 10.10.2.125 xx.31.32.0/20 dev eth0 proto kernel scope link src xx.31.36.249 

总之,这是路由问题,我需要在/etc/ppp/ip-up.d文件夹中添加一个脚本,当vpn / ppp接口出现时,将会运行这个名为routes.sh的脚本。

/etc/ppp/ip-up.d/route

 #!/bin/bash route add -net 10.10.251.32 netmask 255.255.255.255 dev ppp0 route add -net 10.10.247.1 netmask 255.255.255.255 dev ppp0 exit 

然后我还需要在sysctl.conf中启用ipforwarding,命令: net.ipv4.ip_forward = 1

那就是在接口出现时设置路由,并启用转发。