On a Raspberry Pi 3B+ I want to have a all the functionality services (ssh, vnc, dhcp) on a wired intranet on eth0
and the Internet wirelessly on wlan0
. I have installed the servers and under some circumstances I can connect from a Laptop (Windows 10) to the Raspberry Pi via ethernet, get an IP and access using putty, WinSCP and VNC Viewer.
However, I have a few problems for which I would like some help.
- When I define an static IP for
eth0
(Editing/etc/network/interfaces
) then the wifi stops working. - Connection drops after some time, inexplicably to me.
- Sometimes Windows will get an IP outside the DHCP allocated range (i.e 169.254.96.197)
My questions:
- Why adding a static IP for
eth0
in/etc/network/interfaces
breaks wifi? - What could be causing the connection to break?
- Why does windows sometimes not get the IP from the DHCP server? (And how to fix it)
Below some relevant information:
Linux raspberrypi 4.19.97-v7+ #1294 SMP
Without static IP odefinition in /etc/network/interfaces
With static IP odefinition in /etc/network/interfaces
Network failing halfway file transfer
Physical connections:
Laptop : Gigabit USB3 Ethernet adapter
Cat5E Ethernet cable
D-Link DES-108
Cat5E Ethernet cable
Raspberry Pi 3B+
Installation procedure
apt-get update
raspi-config % For ssh and VNC access
apt-get install isc-dhcp-server
sudo service isc-dhcp-server stop
ifconfig eth0 down
dpkg-reconfigure isc-dhcp-server
nano /etc/default/isc-dhcp-server
nano /etc/dhcp/dhcpd.conf
nano /etc/network/interfaces
ifconfig eth0 up
service isc-dhcp-server start
File /etc/default/isc-dhcp-server
contains
INTERFACESv4="eth0"
INTERFACESv6=""
File /etc/network/interfaces
contains
# Static IP for intranet DHCP server
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
File dhcpd.conf
contains
# option definitions common to all supported networks...
option domain-name "internal.mydomain.com";
option domain-name-servers 1.1.1.1, 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
# Subnet declaration.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.250;
option domain-name "internal.mydomain.com";
option broadcast-address 192.168.1.255;
EDIT
I have followed @M._Rostami's advice and installed dnsmasq.conf
. The wifi problem is gone, but still have the problem of been disconnected after some time (or amount of network activity? it seems to correlate with that.) If I disconnect/connect the USB network adapter on the windows laptop side the communication is restored.
WIndows PC routing table
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.100.100.254 10.100.100.112 25
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.113 35
10.100.100.0 255.255.255.0 On-link 10.100.100.112 281
10.100.100.112 255.255.255.255 On-link 10.100.100.112 281
10.100.100.255 255.255.255.255 On-link 10.100.100.112 281
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.1.0 255.255.255.0 On-link 192.168.1.113 291
192.168.1.113 255.255.255.255 On-link 192.168.1.113 291
192.168.1.255 255.255.255.255 On-link 192.168.1.113 291
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 10.100.100.112 281
224.0.0.0 240.0.0.0 On-link 192.168.1.113 291
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 10.100.100.112 281
255.255.255.255 255.255.255.255 On-link 192.168.1.113 291
===========================================================================
Raspberry pi route
pi@raspberrypi:~ $ route -v
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.128.128.128 0.0.0.0 UG 303 0 0 wlan0
10.0.0.0 0.0.0.0 255.0.0.0 U 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
EDIT2
I have tried disabling all other network adaptors both in window side and on Raspberry Pi side. I can consistently make the network to fail (ping will stop, ssh would fail, etc..) by transferring a large file with WinSCP. Connection recovers if I unplug/plug the USB adaptor on the windows side.
cat etc/network/interfaces
,cat /etc/dhcpcd.conf
,cat /etc/dnsmasq.conf
andifconfig
. – M. Rostami Feb 21 '20 at 16:21