Network troubleshooting

From miki
Jump to navigation Jump to search

Troubleshooting network issues

  • DNS server
8.8.8.8       Google DNS server
195.238.2.21  Belgacom DNS server


General troubleshooting on network-manager (nmcli) and iproute2 (ip)

Get status

# Check NM is running using systemctl
systemctl status network-manager.service
# network manager info
nmcli
ip addr

Check for running connections and devices.

To troubleshoot devices:

# Get overview, including routing
nmcli
# Get device list
nmcli d[evice] [list]
# Get device info
nmcli d[evice] show [enp0s31f6 | tun0 | wlp1s0]
# Get device addresses
ip addr

Troubleshoot Wifi

See Wifi.

Troubleshoot DNS

# Check DNS configuration using NM:
$ nmcli | grep "DNS configuration" -A5
# DNS configuration:
# 	servers: 127.0.0.1 192.168.43.1
# 	interface: wlp1s0
# 
# Use "nmcli device show" to get complete information about known devices and
# "nmcli connection show" to get an overview on active connection profiles.

# Check DNS configuration at connection / device level
nmcli d sh enp0s31f6 | grep -i dns
nmcli c sh "Wired connection 1" | grep -i dns

Usually there are several DNS servers available. We can test them each separataly with dig @server:

dig @127.0.0.1 google.com        # 127.0.0.1 is usually NM dnsmasq
dig @192.168.43.1 google.com

Note:

  • 8.8.8.8 is Google DNS server.
  • 1.1.1.1 is CloudFlare Warp DNS.

Can't connect to SMTP server

I can connect to smtp server locally:

nc localhost 25
# 220 www.immie.org ESMTP Exim 4.84_2 Mon, 06 Jun 2016 20:28:47 +0200

But when using the IP address, it does not work:

nc -v -v www.immie.org 25
# DNS fwd/rev mismatch: www.immie.org != vps282013.ovh.net
# immie.org [91.134.134.85] 25 (smtp) : Connection refused
# sent 0, rcvd 0

The firewall is configured to accept connections though:

iptables -L|grep smtp
# ACCEPT     tcp  --  anywhere             anywhere             tcp multiport dports smtp,submission

But in fact, exim only listens to localhost interface:

netstat -lpn|grep 25
# tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      23236/exim4
# tcp6       0      0 ::1:25                  :::*                    LISTEN      23236/exim4

So we must reconfigure exim4 to accept connection from any interface. Reconfigure exim4 and make sure that local interface field is empty:

dpkg-reconfigure exim4-config
grep dc_local_interfaces /etc/exim4/update-exim4.conf.conf
# dc_local_interfaces=''

Note: The DNS fwd/rev mismatch actually comes from a wrong /etc/hosts configuration. This file still contained the old host name:

cat /etc/hosts
# 127.0.0.1       localhost
# 91.134.134.85   vps282013.ovh.net vps282013