Skip to main content
Tweeted twitter.com/super_user/status/1598965285133996032
added 21 characters in body
Source Link
jakob
  • 151
  • 4

I have a portable linux box running ubuntu 16.04 with a single network interface, which when plugged in to a network should make sure that there is a DHCP server on that network. Two cases:

  • (a) if there is DHCP already running on the network, the box should just get an ip there.

  • (b) if no DHCP exists on the network, the box should start a DHCP server.

In the case of (b), I have dnsmasq running. However, I would like the system to automatically detect (a) or (b) and start the dnsmasq service depending on the outcome.

So far my approach was to setup /etc/network/interfaces for eth0 as static (as a basis for the internally provided DHCP) and eth0:1 as dhcp configured. I've tried finding something that would start/stop the dnsmasq service as a result of the dhcp-client after a link becomes available, but could not find such an option.

I have a portable linux box with a single network interface, which when plugged in to a network should make sure that there is a DHCP server on that network. Two cases:

  • (a) if there is DHCP already running on the network, the box should just get an ip there.

  • (b) if no DHCP exists on the network, the box should start a DHCP server.

In the case of (b), I have dnsmasq running. However, I would like the system to automatically detect (a) or (b) and start the dnsmasq service depending on the outcome.

So far my approach was to setup /etc/network/interfaces for eth0 as static (as a basis for the internally provided DHCP) and eth0:1 as dhcp configured. I've tried finding something that would start/stop the dnsmasq service as a result of the dhcp-client after a link becomes available, but could not find such an option.

I have a portable linux box running ubuntu 16.04 with a single network interface, which when plugged in to a network should make sure that there is a DHCP server on that network. Two cases:

  • (a) if there is DHCP already running on the network, the box should just get an ip there.

  • (b) if no DHCP exists on the network, the box should start a DHCP server.

In the case of (b), I have dnsmasq running. However, I would like the system to automatically detect (a) or (b) and start the dnsmasq service depending on the outcome.

So far my approach was to setup /etc/network/interfaces for eth0 as static (as a basis for the internally provided DHCP) and eth0:1 as dhcp configured. I've tried finding something that would start/stop the dnsmasq service as a result of the dhcp-client after a link becomes available, but could not find such an option.

Source Link
jakob
  • 151
  • 4

Only start DHCP server when there is none available elsewhere

I have a portable linux box with a single network interface, which when plugged in to a network should make sure that there is a DHCP server on that network. Two cases:

  • (a) if there is DHCP already running on the network, the box should just get an ip there.

  • (b) if no DHCP exists on the network, the box should start a DHCP server.

In the case of (b), I have dnsmasq running. However, I would like the system to automatically detect (a) or (b) and start the dnsmasq service depending on the outcome.

So far my approach was to setup /etc/network/interfaces for eth0 as static (as a basis for the internally provided DHCP) and eth0:1 as dhcp configured. I've tried finding something that would start/stop the dnsmasq service as a result of the dhcp-client after a link becomes available, but could not find such an option.