6

I recently switch an interface from not being managed by NetworkManager to being managed but it does not get an IP.

I would like to know what is the correct way to usen nmcli to enable dhcp on this interface? for both, ipv4/6.

PS. Obviously that I used help and google before asking here but I failed to find the magic sequence.

sorin
  • 8,016
  • 24
  • 79
  • 103

2 Answers2

12

Finally found it:

nmcli device modify eth0 ipv4.method auto
nmcli device modify eth0 ipv6.method auto

# show results
nmcli device show eth0
sorin
  • 8,016
  • 24
  • 79
  • 103
0

your eth0 should be in "auto" by default. so DHCP is enabled by default. but since you answered your question already i would like to pint out that you can list all available configs for connections nmcli c s eth0 and then you can modify them using nmcli c m eth0 ipv4.method auto. this method requires restarting of interface.

Anton Stafeyev
  • 340
  • 2
  • 3
  • 13