Slow connection/ping after disconnecting VPN

I’m experiencing this weird problem for quite some time and I’ve not found any solution yet.
when I connect to a router using Cable/Wifi everything is okay, I can use different intervals to ping and it works and websites load normally through browser.
now If I connect to a VPN using PPTP/L2TP protocols and then disconnect the VPN, the whole internet connection becomes slow and inconsistent.

in that case I can no longer ping websites with a low interval because the ping interval seems to be fixed on 5 and the browser behavior is crazy! every request takes 5 second to be sent. It worth mentioning that the ping latency remains the same (~70ms before VPN and ~100ms after disconnection)

the only “Fix” for that is to disconnect the network (wifi/cable) and reconnect again. I’ve found this topic and it is kind of relevant to my problem but none of the suggestions worked for me: Issues with pinging websites by DNS name - #18 by AnasR7

I tried ping -i .2 and it worked as expected so the problem seems to be related to DNS resolving after the VPN gets disconnected.

here is my system information

> System:
  Kernel: 5.4.131-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.4-x86_64 
  root=UUID=38377aeb-9b2d-41b8-b166-f4fcd661e4b0 rw quiet udev.log_priority=3 
  btusb.enable_autosuspend=n usbcore.autosuspend=-1 
  Desktop: KDE Plasma 5.22.3 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM 
  Distro: Manjaro Linux base: Arch Linux 
  Type: Laptop System: Apple product: MacBookPro6,1 v: 1.0 serial: <filter> 
  Chassis: type: 10 v: Mac-F22589C8 serial: <filter> 
  Mobo: Apple model: Mac-F22589C8 serial: <filter> UEFI: Apple 
  v: MBP61.88Z.005D.B00.1804100943 date: 04/10/18 
  ID-1: BAT0 charge: 99.3 Wh (100.0%) condition: 99.3/96.4 Wh (103.0%) 
  volts: 8.2 min: 7.3 model: DP bq20z951 type: Li-ion serial: N/A status: Full 
  cycles: 717 
  Info: Dual Core model: Intel Core i5 M 540 bits: 64 type: MT MCP 
  arch: Nehalem family: 6 model-id: 25 (37) stepping: 2 microcode: 11 cache: 
  L2: 3 MiB 
  flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 20225 
  Speed: 1478 MHz min/max: 1197/2528 MHz boost: enabled Core speeds (MHz): 
  1: 1478 2: 1338 3: 1391 4: 1346 
  Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
  Type: l1tf 
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
  Type: mds 
  status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
  Device-1: Intel Core Processor Integrated Graphics driver: i915 v: kernel 
  bus-ID: 00:02.0 chip-ID: 8086:0046 class-ID: 0300 
  Device-2: NVIDIA GT216M [GeForce GT 330M] vendor: Apple driver: nvidia 
  v: 340.108 alternate: nouveau bus-ID: 01:00.0 chip-ID: 10de:0a29 
  class-ID: 0300 
  Device-3: Apple Built-in iSight type: USB driver: uvcvideo bus-ID: 2-1.1:3 
  chip-ID: 05ac:8507 class-ID: 0e02 serial: <filter> 
  Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver: 
  loaded: nvidia display-ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 132 s-size: 369x207mm (14.5x8.1") 
  s-diag: 423mm (16.7") 
  OpenGL: renderer: GeForce GT 330M/PCIe/SSE2 v: 3.3.0 NVIDIA 340.108 
  direct render: Yes 
  Device-1: Intel 5 Series/3400 Series High Definition Audio 
  driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:3b56 
  class-ID: 0403 
  Device-2: NVIDIA GT216 HDMI Audio driver: snd_hda_intel v: kernel 
  bus-ID: 01:00.1 chip-ID: 10de:0be2 class-ID: 0403 
  Sound Server-1: ALSA v: k5.4.131-1-MANJARO running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: yes 
  Sound Server-4: PipeWire v: 0.3.31 running: no 
  Device-1: Broadcom NetXtreme BCM5764M Gigabit Ethernet PCIe driver: tg3 
  v: 3.137 port: 3000 bus-ID: 02:00.0 chip-ID: 14e4:1684 class-ID: 0200 
  IF: enp2s0 state: down mac: <filter> 
  Device-2: Broadcom BCM43224 802.11a/b/g/n vendor: Apple AirPort Extreme 
  driver: wl v: kernel modules: bcma port: 3000 bus-ID: 03:00.0 
  chip-ID: 14e4:4353 class-ID: 0280 
  IF: wlp3s0 state: up mac: <filter> 
  Device-1: Apple Bluetooth Host Controller type: USB driver: btusb v: 0.8 
  bus-ID: 1-1.1.3:7 chip-ID: 05ac:8218 class-ID: fe01 
  Report: rfkill ID: hci0 rfk-id: 1 state: up address: see --recommends 
  Local Storage: total: 689.33 GiB used: 131.48 GiB (19.1%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT240BX500SSD1 
  size: 223.57 GiB block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  rotation: SSD serial: <filter> rev: R013 scheme: GPT 
  ID-2: /dev/sdb maj-min: 8:16 vendor: Hitachi model: HTS545050B9SA02 
  size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 1.5 Gb/s 
  rotation: 5400 rpm serial: <filter> rev: C60W scheme: GPT 
  ID-1: / raw-size: 195.43 GiB size: 191.86 GiB (98.17%) 
  used: 18.56 GiB (9.7%) fs: ext4 dev: /dev/sda3 maj-min: 8:3 
  ID-2: /boot/efi raw-size: 200 MiB size: 196.9 MiB (98.45%) 
  used: 15.3 MiB (7.8%) fs: vfat dev: /dev/sda1 maj-min: 8:1 
  Alert: No swap data was found. 
  System Temperatures: cpu: 59.0 C mobo: N/A gpu: nvidia temp: 59 C 
  Fan Speeds (RPM): N/A 
  Processes: 181 Uptime: 45m wakeups: 8 Memory: 7.7 GiB used: 1.97 GiB (25.6%) 
  Init: systemd v: 248 tool: systemctl Compilers: gcc: 11.1.0 Packages: 
  pacman: 1179 lib: 326 Shell: Bash v: 5.1.8 running-in: yakuake inxi: 3.3.05

surprisingly the issue looks like to be more generic than just to be a manjaro-specific problem. this question on Ask Ubuntu points out the same situation as mine:

So as the OP suggests in that post I looked inside /etc/resolv.conf before and after VPN connection

etc/resolv.conf before connecting to VPN:

# Generated by NetworkManager

etc/resolv.conf after disconnecting the VPN:

# Generated by NetworkManager

the problem solved immediately after removing the first line nameserver - the ping interval and browser behavior went back to normal!

And finally the solution…! You can set a permanent DNS resolver using openresolv

edit /etc/resolvconf.conf and uncomment the name_servers variable and assign your desired DNS ip addresses separated by space :


Next, update /etc/resolv.conf file to make permanent DNS changes;

sudo resolvconf -u

more information:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.