Score:1

temporarily set eth0 to dhcp linux

kw flag

My ip address on a beaglebone is set to:

$ ip address show dev eth0
4: eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 64:33:db:27:e9:d2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.132/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6633:dbff:fe27:e9d2/64 scope link 
       valid_lft forever preferred_lft forever


I can temporarily add a second address for 100 seconds with the command:

sudo ip addr add 192.168.4.244/23 dev eth0 valid_lft 100 preferred_lft 100 

I would like to do the same thing only instead of the second address being static, I would like it assigned by the router (dhcp?/dynamic?) but for the life of me I can't figure out the syntax. any ideas?

I was told that:

ifconfig eth0 0.0.0.0 0.0.0.0 && dhclient

would work but is that ok to do considering my static IP address was set with connman? Also if ifconfig is ok to use how do add the timeout???

TIA

Score:0
us flag
   dhclient eth0:dynamic

here dynamic is just a name for an aliased net interface (you can use any other name here if you want)

dhclient will create an aliased interface on hardware eth0 (assuming eth0:dynamic is not already defined) and then call out on it to get an address using DHCP leaving your existing eth0 configuration untouched.

Jonathan Leslie avatar
kw flag
Thanks Jasen! I'll have to play with this but in the meantime, I got it to work by: 1) getting rid of of /var/lib/connman/default.config 2) Plugging in the cable to the router 3) I noticed that in the directory I got: $ ll /var/lib/connman -rw-r--r-- 1 root root 55 Dec 7 14:45 default_bu_221207.config drwxrwxrwx 2 root root 4096 Apr 13 2022 ethernet_402e71cd1835_cable/ drwxrwxrwx 2 root root 4096 Dec 7 14:56 ethernet_6433db27e9d2_cable/ -rw-rw-rw- 1 root root 55 Oct 18 06:40 hide_default.config -rw-r--r-- 1 root root 216 Apr 6 2020 settings
Jonathan Leslie avatar
kw flag
and then issued: > connmanctl config ethernet_985dad375f63_cable --ipv4 dhcp < where I used my ethernet_blablabla_cable from the list of directories in /var/lib/connman
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.