I am working with a arm micro-controller. Currently the controller is configured as a dhcp client on eth0 (ethernet jack) and as a dhcp server on eth1. I want to configure it to also serve dhcp on eth0, so that it will be a client when it is connected to a router, or be a server when connected to a laptop/hub. I want to be able to tell the controller to be a server or be a client from the front end. I am not entirely sure how to go about doing that as I am fairly new to linux dev.
I have looked into the /etc/udhcpd.conf file but i'm not sure if I should add interface eth0 there. Also looked into the /etc/networking/interfaces file and the udhcpd.service files but I'm not sure what to modify. Could you please give me some direction as to how I can configure the controller to be a server or a client on demand on eth0?
Here are the contents of the files contents for more info:
start 10.77.0.2 end 10.77.255.200 interface eth1 opt dns 188.8.131.52 184.108.40.206 #public google dns servers option subnet 255.255.0.0 opt router 10.77.0.1
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" /proc/cmdline > /dev/null udhcpc_opts -R -b iface eth1 inet static address 10.77.0.1 netmask 255.255.0.0
[Unit] Description=udhcpd Service After=startup.service [Service] ExecStartPre=/sbin/ifup eth1 ExecStart=/usr/sbin/udhcpd -f -S /etc/udhcpd.conf TimeoutSec=infinity [Install] WantedBy=multi-user.target