ifconfig eth0 dhcp start or ifconfig eth0 dhcp drop does not seem to work for Android. Is there a way to enable/disable DHCP for eth0 via shell commands?
2 Answers
try this code in android 5.1
ifconfig eth0 up dhcpcd eth0 OR (static)
ifconfig eth0 192.168.70.65 netmask 255.255.255.0 up and now
ndc network create 100 ndc network interface add 100 eth0 ndc network route add 100 eth0 192.168.70.0/24 (gateway) ndc network route add 100 eth0 0.0.0.0/0 192.168.2.40 192.168.2.50 ndc resolver setnetdns 100 localdomain 192.168.2.40 192.168.2.50 (dns1 dns2) ndc network default set 100 - dhcpcd eth0.15 dhcpcd[4415]: version 5.5.6 starting setprop: applet not found setprop: applet not found dhcpcd[4415]: eth0.15: carrier lost setprop: applet not found dhcpcd[4415]: eth0.15: carrier acquired setprop: applet not found dhcpcd[4415]: eth0.15: sending IPv6 Router Solicitation dhcpcd[4415]: eth0.15: sendmsg: Cannot assign requested address dhcpcd[4415]: eth0.15: rebinding lease of 192.168.88.2 dhcpcd[4415]: eth0.15: sending IPv6 Router Solicitation dhcpcd[4415]: eth0.15: broadcasting for a lease dhcpcd[4415]: eth0.15: sending IPv6 Router SolicitationCS QGB– CS QGB2022-12-20 09:30:07 +00:00Commented Dec 20, 2022 at 9:30
try this way (My Android device worked)
DHCP IP
ifconfig eth0 dhcp OR
setprop dhcp.eth0 OR
dhcpcd -k eth0 dhcpcd -n eth0 OR
netcfg eth0 dhcp OR
getprop dhcp.eth0 and Static IP
ifconfig eth0 192.168.70.145 netmask 255.255.255.0 up route add default gw 192.168.70.254 dev eth0 or
su -c ifconfig eth0 192.168.70.145 netmask 255.255.255.0 up route add default gw 192.168.70.254 dev eth0 Enable Ethernet
ifconfig eth0 up Disable Ethernet
ifconfig eth0 down and check wlan0 static or dynamic? my device when wlan0 is static force once set eth0 static and after set static change to dynamic
check the device ip:
ip addr ********** try this android 5.1 ****************** eth0 dhcp
ifconfig eth0 down ifconfig eth0 up dhcpcd -k eth0 dhcpcd -n eth0 netcfg eth0 dhcp
netcfg?netcfg eth0 dhcp. See headlessandroid.blogspot.in/2012/06/…. Don't know how to disable DHCP.