Mats_berndtsson
Posts: 21
Joined: Thu Jun 16, 2016 7:54 am

eth0 loses IP address if i unplug the cable

Wed Nov 15, 2017 10:29 am

Hi,

i set up eth0 in dhcpcd.conf to use a static IP, 192.168.3.14/24 and i have
a LTE Modem as well , called wan0 , i can log on through as well.

i have set up routing between the two so i can reach an application that will only listen to the static IP, even from the wan interface. This works as long as something is plugged into the ethernet socket, usually an ethernet switch...

BUT, if i unplug the cable to eth0, the interface loses the IP address, why is that ?
if i do ifconfig, i can see eth0, but it no longer has an "inet section" and then i plug the cable in again, and do ifconfig, the interface has my static address again.

when this happens my application that only listens at 192.168.3.14 will not respond, even when i try to access it from the wwan interface.

can i "lock" eth0 down so unplugging does not blank out the IP address ?

knute
Posts: 446
Joined: Thu Oct 23, 2014 12:14 am
Location: Texas
Contact: Website

Re: eth0 loses IP address if i unplug the cable

Wed Nov 15, 2017 4:38 pm

Mats_berndtsson wrote:
Wed Nov 15, 2017 10:29 am
Hi,

i have set up routing between the two so i can reach an application that will only listen to the static IP, even from the wan interface. This works as long as something is plugged into the ethernet socket, usually an ethernet switch...
That doesn't make any sense, maybe you better explain that some more.
when this happens my application that only listens at 192.168.3.14 will not respond, even when i try to access it from the wwan interface.
Change the address it listens to to the localhost.

Mats_berndtsson
Posts: 21
Joined: Thu Jun 16, 2016 7:54 am

Re: eth0 loses IP address if i unplug the cable

Thu Dec 14, 2017 10:49 am

i tried setting it to localhost, but it is a web application, so it builds urls from this ip address and then remote clients start looking for files on 127.0.0.1 and just can't find them. the application is not clever enough to listen on "any" interface and needs to be told one ip address through it's config file.

i can't use the IP from the other interface "wwan0" as it is not static.

best would be if i could disable media sensing on eth0 so that it thinks it is "up" even when there is no cable plugged in.

Return to “Networking and servers”