VPN连接后无法访问网络,DNS无法解析

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

VPN连接后无法访问网络,DNS无法解析

#1

帖子 xiaoxioa »

小弟有些小白,真诚求教,先道谢!
我使用的AventailConnect客户端,连接VPN后无法连接内网、外网,后发现DNS无法解析。
连接后的DNS配置:

代码: 全选

# Aventail VPN ConnectionGenerated, to restore copy from /etc/resolv.conf.Sonicwall
nameserver 10.13.6.2
nameserver 10.13.6.3
NGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
网络端口信息:

代码: 全选

enp0s25   Link encap:Ethernet  HWaddr 3c:97:0e:e6:3b:ca  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:f2500000-f2520000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:408 errors:0 dropped:0 overruns:0 frame:0
          TX packets:408 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:39964 (39.9 KB)  TX bytes:39964 (39.9 KB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.13.15.105  P-t-P:10.13.15.105  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1452  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:324 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:52 (52.0 B)

wlp3s0    Link encap:Ethernet  HWaddr 70:18:8b:f7:87:1b  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::cb43:588c:559b:f390/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:485 errors:0 dropped:0 overruns:0 frame:0
          TX packets:642 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:189175 (189.1 KB)  TX bytes:142808 (142.8 KB)
IP转发已启用( /etc/sysctl.conf)

代码: 全选

net.ipv4.ip_forward=1
iptables配置

代码: 全选

iptables -A FORWARD -i wlp3s0 -o tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o wlp3s0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

代码: 全选

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
以上配置完成后,127.0.0.1和虚拟IP能ping通,DNS服务器不通

代码: 全选

root@xxx:/home/xxx# ping -c 3 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.052 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.039/0.047/0.052/0.005 ms
root@xxx:/home/xxx# ping -c 3 10.13.15.105
PING 10.13.15.105 (10.13.15.105) 56(84) bytes of data.
64 bytes from 10.13.15.105: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from 10.13.15.105: icmp_seq=2 ttl=64 time=0.047 ms
64 bytes from 10.13.15.105: icmp_seq=3 ttl=64 time=0.048 ms

--- 10.13.15.105 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.037/0.044/0.048/0.005 ms
root@xxx:/home/xxx# ping -c 3 10.13.6.2
PING 10.13.6.2 (10.13.6.2) 56(84) bytes of data.


^C
--- 10.13.6.2 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2016ms
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#2

帖子 xiaoxioa »

连接VPN后,tcpdump无任何数据传输
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#3

帖子 poloshiao »

nameserver 127.0.1.1
DNS服务器不通
試試
ping -c 3 127.0.1.1
连接VPN后,tcpdump无任何数据传输
如果指 ping 指令
ping 不是使用 tcp
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#4

帖子 xiaoxioa »

poloshiao 写了:
nameserver 127.0.1.1
DNS服务器不通
試試
ping -c 3 127.0.1.1
连接VPN后,tcpdump无任何数据传输
如果指 ping 指令
ping 不是使用 tcp
刚才又试了下,使用tcpdump能看到ping发出的ICMP协议数据,但只有发送无响应数据
ping -c 3 127.0.1.1是通的
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#5

帖子 poloshiao »

ping -c 3 127.0.1.1是通的
ping -c 3 10.13.6.2
PING 10.13.6.2 (10.13.6.2) 56(84) bytes of data.
1. 意思是 vpn 提供的 DNS 無法連接 ?
1-1. 向 VPN 帳號 供應者 諮詢看看

2. 在 /etc/resolv.conf
nameserver 10.13.6.2
前面 加上
nameserver 8.8.8.8
看看行不行

3. 請再貼文
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#6

帖子 xiaoxioa »

poloshiao 写了:
ping -c 3 127.0.1.1是通的
ping -c 3 10.13.6.2
PING 10.13.6.2 (10.13.6.2) 56(84) bytes of data.
1. 意思是 vpn 提供的 DNS 無法連接 ?
1-1. 向 VPN 帳號 供應者 諮詢看看

2. 在 /etc/resolv.conf
nameserver 10.13.6.2
前面 加上
nameserver 8.8.8.8
看看行不行

3. 請再貼文
您好,是的VPN push的dns无法ping通。
在resolv.conf最上方增加8.8.8.8之后仍无法解析,ping 8.8.8.8也是不通的。
如果是dns的问题,直接使用IP应该是可以访问的吧?
现在tcpdump -i tun0能看到发送的数据,tcpdump -i wlp3s0无报文数据。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#7

帖子 poloshiao »

直接使用IP应该是可以访问的吧?
可以試試 如果可以 請再貼文
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#8

帖子 xiaoxioa »

poloshiao 写了:
直接使用IP应该是可以访问的吧?
可以試試 如果可以 請再貼文
不可以的,上文提到过 直接ping ip也不通,更谈不上可用了 :Cry
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#9

帖子 poloshiao »

上文提到过 直接ping ip也不通,更谈不上可用了
你的 VPN Server 的 IP 可以 ping 得通嗎 (不是 DNS 或 localhost) ?

參閱
https://help.ubuntu.com/16.04/servergui ... figuration
Simple Client Configuration
Check if you can ping the OpenVPN server:
ping 10.8.0.1
Check out your routes:
netstat -rn
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#10

帖子 xiaoxioa »

poloshiao 写了:
上文提到过 直接ping ip也不通,更谈不上可用了
你的 VPN Server 的 IP 可以 ping 得通嗎 (不是 DNS 或 localhost) ?

參閱
https://help.ubuntu.com/16.04/servergui ... figuration
Simple Client Configuration
Check if you can ping the OpenVPN server:
ping 10.8.0.1
Check out your routes:
netstat -rn
hello,感谢!在看了,vpn server可以的IP可以ping通。

代码: 全选

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.13.15.105  P-t-P:10.13.15.105  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1452  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:324 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:52 (52.0 B)
inet addr和P-tP两个ip一样都是10.13.15.105,这个对吗?
查看路由表,发现tun0网卡发出数据的目的地址也是10.13.15.105。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#11

帖子 poloshiao »

tun0
inet addr:10.13.15.105 P-t-P:10.13.15.105 Mask:255.255.255.255
inet addr和P-tP两个ip一样都是10.13.15.105,这个对吗?
查看路由表,发现tun0网卡发出数据的目的地址也是10.13.15.105。
這個 10.13.15.105 應該是指你的電腦 client 端的端口
你要 ping 的是 tunnel 另一端的 Server 的端口 或 gateway 或 Server 的 IP
查閱 你的 VPN 提供的文件
inet addr:10.13.15.105 P-t-P:10.13.15.105 Mask:255.255.255.255
這個有問題
你兩個都是 10.13.15.105
P-t-P:這個地方應該是 Server 的 gateway 端口
除非 10.13.15.105 剛好是 gateway
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#12

帖子 xiaoxioa »

poloshiao 写了:
tun0
inet addr:10.13.15.105 P-t-P:10.13.15.105 Mask:255.255.255.255
inet addr和P-tP两个ip一样都是10.13.15.105,这个对吗?
查看路由表,发现tun0网卡发出数据的目的地址也是10.13.15.105。
這個 10.13.15.105 應該是指你的電腦 client 端的端口
你要 ping 的是 tunnel 另一端的 Server 的端口 或 Server 的 IP
查閱 你的 VPN 提供的文件
inet addr:10.13.15.105 P-t-P:10.13.15.105 Mask:255.255.255.255
這個有問題
你兩個都是 10.13.15.105
P-t-P:這個地方應該是 Server 的 端口 或 gateway
刚才用同事的电脑登录了一下VPN中的inet addr和P-t-P也是一样的,但可以正常使用。
不同点在这个地方,我笔记本的有NOARP 同事的无这个信息:
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.13.15.105 P-t-P:10.13.15.105 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1452 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:324 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:52 (52.0 B)
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#13

帖子 poloshiao »

我笔记本的有NOARP 同事的无这个信息:
http://www.tldp.org/LDP/nag2/x-087-2-if ... onfig.html
arp
This is an option specific to broadcast networks such as Ethernets or packet radio. It enables the use of the Address Resolution Protocol (ARP) to detect the physical addresses of hosts attached to the network. For broadcast networks, it is on by default. If ARP is disabled, ifconfig displays the NOARP flag.
表示 你的 arp 被關閉了
在 啟動指令 加上 arp 就可以啟動

不過 好像不是關鍵影響
https://help.ubuntu.com/16.04/servergui ... figuration
Check if it created a tun0 interface:
ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.6 P-t-P:10.8.0.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
刚才用同事的电脑登录了一下VPN中的inet addr和P-t-P也是一样的,但可以正常使用。
試試 使用他的設定
看看 能否成功
xiaoxioa
帖子: 16
注册时间: 2011-05-09 0:07

Re: VPN连接后无法访问网络,DNS无法解析

#14

帖子 xiaoxioa »

poloshiao 写了:
我笔记本的有NOARP 同事的无这个信息:
http://www.tldp.org/LDP/nag2/x-087-2-if ... onfig.html
arp
This is an option specific to broadcast networks such as Ethernets or packet radio. It enables the use of the Address Resolution Protocol (ARP) to detect the physical addresses of hosts attached to the network. For broadcast networks, it is on by default. If ARP is disabled, ifconfig displays the NOARP flag.
表示 你的 arp 被關閉了
在 啟動指令 加上 arp 就可以啟動

不過 好像不是關鍵影響
https://help.ubuntu.com/16.04/servergui ... figuration
Check if it created a tun0 interface:
ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.6 P-t-P:10.8.0.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
刚才用同事的电脑登录了一下VPN中的inet addr和P-t-P也是一样的,但可以正常使用。
試試 使用他的設定
看看 能否成功
hello, @poloshiao。
开启arp好像没有什么效果。昨晚查询了下和aventail connect相关内容,了解到sonicWall使用的是IPSec协议。
然后尝试打开三个terminal,其中两个使用tcpdump -e -i wlp3s0 和tcpdump -e -i tun0打印wlp3s0和tun0传输的报文,
另外一个terminal尝试一直不停的ping 某个域名,发现tun0报文发发送会快些 wlp3s很慢 并且只有发送没有接收,
在ping结束时能看到wlp3s和tun0都收到了响应。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: VPN连接后无法访问网络,DNS无法解析

#15

帖子 poloshiao »

我使用的 AventailConnect 客户端
# Aventail VPN ConnectionGenerated, to restore copy from /etc/resolv.conf.Sonicwall
看看 這一篇 及其連結文章 能否幫你
http://superuser.com/questions/141834/c ... ux-machine
Connecting to a SonicWall VPN from a Linux machine
回复