start dhcpcd on specific interfaces only explicitly












0















On my machine I have multiple interfaces which often have a dhcp server running. I now want to react differently on various 'setups':




  • when there is wifi, use wifi

  • when there is ethernet, use ethernet (I have an extra profile there, too)

  • when there is both, use one of them (or both, or whatever.. just work)

  • when interface usb0 or usb1 occur, only enable dhcp on them when someone issues dhcpcd <interface>


My current dhcpcd.conf looks like



# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private


interface eth0
arping 192.168.1.77

profile 192.168.1.77
static ip_address=192.168.1.65
static routers=192.168.1.77
static domain_name_servers=192.168.1.77


interface usb0
nogateway

interface usb1
nogateway


The wifi/ethernet part seems to work, though I haven't tested it thoroughly. But I don't know, how to set up my usb interfaces to only respond to DHCP on command. The nogateway is just there to prevent usb interfaces to screw up my default routes ATM.



How do I need to configure dhcpcd?



Edit 1:
I am on a Gentoo system with no more network configuration except my wpa_supplicant.conf










share|improve this question
















bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    On my machine I have multiple interfaces which often have a dhcp server running. I now want to react differently on various 'setups':




    • when there is wifi, use wifi

    • when there is ethernet, use ethernet (I have an extra profile there, too)

    • when there is both, use one of them (or both, or whatever.. just work)

    • when interface usb0 or usb1 occur, only enable dhcp on them when someone issues dhcpcd <interface>


    My current dhcpcd.conf looks like



    # See dhcpcd.conf(5) for details.

    # Allow users of this group to interact with dhcpcd via the control socket.
    #controlgroup wheel

    # Inform the DHCP server of our hostname for DDNS.
    hostname

    # Use the hardware address of the interface for the Client ID.
    #clientid
    # or
    # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
    # Some non-RFC compliant DHCP servers do not reply with this set.
    # In this case, comment out duid and enable clientid above.
    duid

    # Persist interface configuration when dhcpcd exits.
    persistent

    # Rapid commit support.
    # Safe to enable by default because it requires the equivalent option set
    # on the server to actually work.
    option rapid_commit

    # A list of options to request from the DHCP server.
    option domain_name_servers, domain_name, domain_search, host_name
    option classless_static_routes
    # Most distributions have NTP support.
    option ntp_servers
    # Respect the network MTU. This is applied to DHCP routes.
    option interface_mtu

    # A ServerID is required by RFC2131.
    require dhcp_server_identifier

    # Generate Stable Private IPv6 Addresses instead of hardware based ones
    slaac private


    interface eth0
    arping 192.168.1.77

    profile 192.168.1.77
    static ip_address=192.168.1.65
    static routers=192.168.1.77
    static domain_name_servers=192.168.1.77


    interface usb0
    nogateway

    interface usb1
    nogateway


    The wifi/ethernet part seems to work, though I haven't tested it thoroughly. But I don't know, how to set up my usb interfaces to only respond to DHCP on command. The nogateway is just there to prevent usb interfaces to screw up my default routes ATM.



    How do I need to configure dhcpcd?



    Edit 1:
    I am on a Gentoo system with no more network configuration except my wpa_supplicant.conf










    share|improve this question
















    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      On my machine I have multiple interfaces which often have a dhcp server running. I now want to react differently on various 'setups':




      • when there is wifi, use wifi

      • when there is ethernet, use ethernet (I have an extra profile there, too)

      • when there is both, use one of them (or both, or whatever.. just work)

      • when interface usb0 or usb1 occur, only enable dhcp on them when someone issues dhcpcd <interface>


      My current dhcpcd.conf looks like



      # See dhcpcd.conf(5) for details.

      # Allow users of this group to interact with dhcpcd via the control socket.
      #controlgroup wheel

      # Inform the DHCP server of our hostname for DDNS.
      hostname

      # Use the hardware address of the interface for the Client ID.
      #clientid
      # or
      # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
      # Some non-RFC compliant DHCP servers do not reply with this set.
      # In this case, comment out duid and enable clientid above.
      duid

      # Persist interface configuration when dhcpcd exits.
      persistent

      # Rapid commit support.
      # Safe to enable by default because it requires the equivalent option set
      # on the server to actually work.
      option rapid_commit

      # A list of options to request from the DHCP server.
      option domain_name_servers, domain_name, domain_search, host_name
      option classless_static_routes
      # Most distributions have NTP support.
      option ntp_servers
      # Respect the network MTU. This is applied to DHCP routes.
      option interface_mtu

      # A ServerID is required by RFC2131.
      require dhcp_server_identifier

      # Generate Stable Private IPv6 Addresses instead of hardware based ones
      slaac private


      interface eth0
      arping 192.168.1.77

      profile 192.168.1.77
      static ip_address=192.168.1.65
      static routers=192.168.1.77
      static domain_name_servers=192.168.1.77


      interface usb0
      nogateway

      interface usb1
      nogateway


      The wifi/ethernet part seems to work, though I haven't tested it thoroughly. But I don't know, how to set up my usb interfaces to only respond to DHCP on command. The nogateway is just there to prevent usb interfaces to screw up my default routes ATM.



      How do I need to configure dhcpcd?



      Edit 1:
      I am on a Gentoo system with no more network configuration except my wpa_supplicant.conf










      share|improve this question
















      On my machine I have multiple interfaces which often have a dhcp server running. I now want to react differently on various 'setups':




      • when there is wifi, use wifi

      • when there is ethernet, use ethernet (I have an extra profile there, too)

      • when there is both, use one of them (or both, or whatever.. just work)

      • when interface usb0 or usb1 occur, only enable dhcp on them when someone issues dhcpcd <interface>


      My current dhcpcd.conf looks like



      # See dhcpcd.conf(5) for details.

      # Allow users of this group to interact with dhcpcd via the control socket.
      #controlgroup wheel

      # Inform the DHCP server of our hostname for DDNS.
      hostname

      # Use the hardware address of the interface for the Client ID.
      #clientid
      # or
      # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
      # Some non-RFC compliant DHCP servers do not reply with this set.
      # In this case, comment out duid and enable clientid above.
      duid

      # Persist interface configuration when dhcpcd exits.
      persistent

      # Rapid commit support.
      # Safe to enable by default because it requires the equivalent option set
      # on the server to actually work.
      option rapid_commit

      # A list of options to request from the DHCP server.
      option domain_name_servers, domain_name, domain_search, host_name
      option classless_static_routes
      # Most distributions have NTP support.
      option ntp_servers
      # Respect the network MTU. This is applied to DHCP routes.
      option interface_mtu

      # A ServerID is required by RFC2131.
      require dhcp_server_identifier

      # Generate Stable Private IPv6 Addresses instead of hardware based ones
      slaac private


      interface eth0
      arping 192.168.1.77

      profile 192.168.1.77
      static ip_address=192.168.1.65
      static routers=192.168.1.77
      static domain_name_servers=192.168.1.77


      interface usb0
      nogateway

      interface usb1
      nogateway


      The wifi/ethernet part seems to work, though I haven't tested it thoroughly. But I don't know, how to set up my usb interfaces to only respond to DHCP on command. The nogateway is just there to prevent usb interfaces to screw up my default routes ATM.



      How do I need to configure dhcpcd?



      Edit 1:
      I am on a Gentoo system with no more network configuration except my wpa_supplicant.conf







      network-interface dhcp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 12 '16 at 14:02







      Uroc327

















      asked Dec 11 '16 at 23:05









      Uroc327Uroc327

      16529




      16529





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If you are running a Debian based distro just look at the last lines of /etc/default/isc-dhcp-server:



          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
          # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
          INTERFACES="eth1"





          share|improve this answer
























          • I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

            – Uroc327
            Dec 12 '16 at 14:03











          • man dhcpd. Simply add a trailing eth0 or any other device as parameter.

            – Ipor Sircer
            Dec 12 '16 at 14:11











          • Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

            – Uroc327
            Dec 12 '16 at 14:12











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f329690%2fstart-dhcpcd-on-specific-interfaces-only-explicitly%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If you are running a Debian based distro just look at the last lines of /etc/default/isc-dhcp-server:



          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
          # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
          INTERFACES="eth1"





          share|improve this answer
























          • I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

            – Uroc327
            Dec 12 '16 at 14:03











          • man dhcpd. Simply add a trailing eth0 or any other device as parameter.

            – Ipor Sircer
            Dec 12 '16 at 14:11











          • Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

            – Uroc327
            Dec 12 '16 at 14:12
















          0














          If you are running a Debian based distro just look at the last lines of /etc/default/isc-dhcp-server:



          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
          # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
          INTERFACES="eth1"





          share|improve this answer
























          • I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

            – Uroc327
            Dec 12 '16 at 14:03











          • man dhcpd. Simply add a trailing eth0 or any other device as parameter.

            – Ipor Sircer
            Dec 12 '16 at 14:11











          • Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

            – Uroc327
            Dec 12 '16 at 14:12














          0












          0








          0







          If you are running a Debian based distro just look at the last lines of /etc/default/isc-dhcp-server:



          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
          # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
          INTERFACES="eth1"





          share|improve this answer













          If you are running a Debian based distro just look at the last lines of /etc/default/isc-dhcp-server:



          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
          # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
          INTERFACES="eth1"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 11 '16 at 23:11









          Ipor SircerIpor Sircer

          10.8k11124




          10.8k11124













          • I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

            – Uroc327
            Dec 12 '16 at 14:03











          • man dhcpd. Simply add a trailing eth0 or any other device as parameter.

            – Ipor Sircer
            Dec 12 '16 at 14:11











          • Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

            – Uroc327
            Dec 12 '16 at 14:12



















          • I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

            – Uroc327
            Dec 12 '16 at 14:03











          • man dhcpd. Simply add a trailing eth0 or any other device as parameter.

            – Ipor Sircer
            Dec 12 '16 at 14:11











          • Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

            – Uroc327
            Dec 12 '16 at 14:12

















          I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

          – Uroc327
          Dec 12 '16 at 14:03





          I am on a Gentoo system. How does debian start dhcpcd when INTERFACES is specified?

          – Uroc327
          Dec 12 '16 at 14:03













          man dhcpd. Simply add a trailing eth0 or any other device as parameter.

          – Ipor Sircer
          Dec 12 '16 at 14:11





          man dhcpd. Simply add a trailing eth0 or any other device as parameter.

          – Ipor Sircer
          Dec 12 '16 at 14:11













          Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

          – Uroc327
          Dec 12 '16 at 14:12





          Well, I don't start dhcpcd manually but I use gentoos rc scripts/runlevels instead.

          – Uroc327
          Dec 12 '16 at 14:12


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f329690%2fstart-dhcpcd-on-specific-interfaces-only-explicitly%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt