Is there a way to set default eth0 setup in linux. I know I can give it a default static IP at boot up with
sudo ip route add default via 10.0.0.1 dev eth0. Is there a way to change it to DHCP at bootup. AND if it's in DHCP but I do NOT have my ethernet cable connected to the network, I want it to be set to an IP address so that it always has a way to be able to connect to it at bootup without any extra commands from the terminal. So.... a default IP address if a DHCP address is not found. Is this possible? and how?
Backstory: I'm writing a c++ console application that is listening from a socket. The end user connects to my linux device (via Windows PC usually) and can then send commands. Everything work as of now, but I want the end user to have the option of setting the default to static of dynamic at startup. They can only connect to the application if there is an IP address present. I want to add this just in case the user forgets to connect to the server if it is in dhcp mode at startup.