Network troubleshooting: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with '== Troubleshooting network issues == * Ping DNS server 8.8.8.8 Google DNS server 195.238.2.21 Belgacom DNS server * Ping gateway (see netroute)')
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Troubleshooting network issues ==
== Troubleshooting network issues ==
* Ping DNS server
* DNS server
8.8.8.8 Google DNS server
8.8.8.8 Google DNS server
195.238.2.21 Belgacom DNS server
195.238.2.21 Belgacom DNS server

* Ping gateway (see netroute)

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

=== Get status ===
<source lang="bash">
# Check NM is running using systemctl
systemctl status network-manager.service
# network manager info
nmcli
ip addr
</source>
Check for running connections and devices.

To troubleshoot devices:
<source lang="bash">
# 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
</source>

=== Troubleshoot Wifi ===
See [[Wifi]].

=== Troubleshoot DNS ===
<source lang="bash">
# 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
</source>

Usually there are several DNS servers available. We can test them each separataly with <code>dig @server</code>:
<source lang="bash">
dig @127.0.0.1 google.com # 127.0.0.1 is usually NM dnsmasq
dig @192.168.43.1 google.com
</source>

Note:
* <code>8.8.8.8</code> is Google DNS server.
* <code>1.1.1.1</code> is CloudFlare Warp DNS.

== Can't connect to SMTP server ==
I can connect to smtp server locally:
<source lang=bash>
nc localhost 25
# 220 www.immie.org ESMTP Exim 4.84_2 Mon, 06 Jun 2016 20:28:47 +0200
</source>

But when using the IP address, it does not work:
<source lang=bash>
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
</source>

The firewall is configured to accept connections though:
<source lang=bash>
iptables -L|grep smtp
# ACCEPT tcp -- anywhere anywhere tcp multiport dports smtp,submission
</source>

But in fact, exim only listens to localhost interface:
<source lang=bash>
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
</source>

So we must reconfigure exim4 to accept connection from any interface. Reconfigure exim4 and make sure that local interface field is empty:
<source lang=bash>
dpkg-reconfigure exim4-config
grep dc_local_interfaces /etc/exim4/update-exim4.conf.conf
# dc_local_interfaces=''
</source>

'''Note''': The <code>DNS fwd/rev</code> mismatch actually comes from a wrong {{file|/etc/hosts}} configuration. This file still contained the old host name:
<source lang=bash>
cat /etc/hosts
# 127.0.0.1 localhost
# 91.134.134.85 vps282013.ovh.net vps282013
</source>

Latest revision as of 19:49, 29 December 2019

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