One command to start interface in dhcp mode?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

GoldenBigun

New Member
Jan 16, 2013
8
0
1
Isn't there a CLI command in Linux to start an interface in dhcp mode? Like ip up eth1 dhcp?

I thought I read that on the STH forums but I can't find it and googlefu is not working for me.
 

wsuff

Member
Aug 16, 2015
75
13
8
What distribution are you using? It tends to vary slightly. Also do you plan to change this permanently for that interface? If so changing your interface config setting & restarting networking might be best.

Sent from my Nexus 6P using Tapatalk
 

wsuff

Member
Aug 16, 2015
75
13
8
Dhclient used to be the userland command for dhcp but haven't needed to run it directly due to system network management tools in recent distributions.

Sent from my Nexus 6P using Tapatalk
 

GoldenBigun

New Member
Jan 16, 2013
8
0
1
What distribution are you using? It tends to vary slightly. Also do you plan to change this permanently for that interface? If so changing your interface config setting & restarting networking might be best.

Sent from my Nexus 6P using Tapatalk
Normally CentOS but in this case I have to do a bunch of Ubuntu servers.

I don't need these to survive reboot, just bring up network once with DHCP address.
 

wsuff

Member
Aug 16, 2015
75
13
8
I usually just edit the /etc/sysconfig/networking-scripts/ifcfg-eth0 and set
BOOTPROTO=dhcp

but dhclient eth0 should probably also function for 1 off use.