I am currently working on Raspberry Pi 3B+ (Stretch 9) and I have been stumped on how to be connected online wirelessly while also having my LAN port configured to receive and send data via a crossover Ethernet cable to an external piece of hardware (Note: the hardware via the LAN port is being interrogated with a Java program and does not need a bridged connection). The hardware defaults to the following settings:
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.1
I can make the hardware work by the edit shown below but it disables my wireless connection.
Editing the /etc/dhcpcd.conf with:
interface eth0
static ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
If this might be any help hardware works but disconnected wirelessly from the internet, here is the output of route -n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
0.0.0.0 192.168.1.8 0.0.0.0 UG 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
Edit: When disconnecting the Ethernet cable the wifi works again. As far as I can tell it is due to the default route of the Ethernet (thanks softweyr), however I am still unsure as to how to solve this. In "route -v" it shows:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
default 192.168.1.8 0.0.0.0 UG 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
Final Solution: I changed the hardware interface connection to 192.168.2.255 so that eth0 and wlan0 would not be in the same subnet (thanks Ingo) and changed as follows: /etc/dhcpcd.conf
interface wlan0
static ip_address=undefined/24
static routers=undefined
static domain_name_servers=undefined 8.8.8.8
interface eth0
static ip_address=192.168.2.200/24
static domain_name_servers=192.168.2.0
route print
.static domain_name_servers=192.168.2.0
in/etc/dhcpcd.conf
. Please don't use this address as single ip address for e.g. a nameserver. It is not a single ip address and you cannot reach a network device with it. This address stands for the whole subnet 192.168.2.0/24 (single addresses 192.168.2.1 - 192.168.2.254, 192.168.2.255 is the broadcast address).