Renew DHCP Lease without knowing if en0 or en1

2

Dear Superuser Community,

I'm writing on a a script that renews the DHCP Lease. To function correctly on other computers, how can renew the DHCP Lease without knowing if en0 or en1 is active.

Is it ok to reset both: sudo ipconfig set en0 DHCP; sudo ipconfig set en1 DHCP?

Edit: The OS is OSX El Capitan (Sorry, I forgot the most important info)

Thanks in advance

Max

Posted 2016-07-18T19:20:47.613

Reputation: 21

1What OS is this for? – Zoredache – 2016-07-18T20:59:16.460

It's for OSX El Capitan (Sorry I missed that) – Max – 2016-07-19T20:24:32.117

Answers

0

If I remember correctly, as long as both interfaces are defined in /etc/network/interfaces running the command on both should be fine.

EDIT: I assumed this was a Linux question based on the use of sudo. It may be useful to add this to your question since ipconfig is a Windows command.

Jake Charman

Posted 2016-07-18T19:20:47.613

Reputation: 23

It's for OSX El Capitan - thanks for the hint, I added this in my question – Max – 2016-07-19T20:25:24.883

I believe the info in my answer is still correct for OSX however Mac isn't my strong point so I'm not entirely sure. – Jake Charman – 2016-07-19T20:49:14.677