Results 1 to 10 of 10

Thread: How to add IP range as CentOS in OpenSUSE?

  1. #1

    Red face How to add IP range as CentOS in OpenSUSE?

    Hello,

    I'm trying to switch from CentOS to OpenSUSE.
    I have a server with 100+ IPs alias. When I use CentOS to add these IPs, I can simple:

    nano /etc/sysconfig/network-scripts/ifcfg-eth0-range0
    IPADDR_START=xxxx
    IPADDR_END=xxxx
    CLONENUM_START=0

    Can I ask in OpenSUSE 42.3, how can I do it similarly? Thank you.

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: How to add IP range as CentOS in OpenSUSE?

    How interesting.
    I can't remember anyone asking this question before(adding a massive number of aliases to a network interface).
    And, I don't see anything in any SUSE or openSUSE documentation.

    Personally,
    I've found that if you want to edit existing ifcfig files directly, all usual parameters are supported including adding alias addresses.

    But using a script file?
    A simple check reveals that the SUSE/openSUSE network script directory is in a different location.
    I guess you can try placing the file you normally create in CentOS/RHEL/Fedora in this directory instead and see what happens
    Code:
    /etc/sysconfig/network/scripts/
    Personally, if your desired address range is supported by a properly configured network address/network mask combination, I'd try adding that to the existing ifcfg file either by direct edit or by using the YaST > System > Network Settings > Select the Network Interface and Edit > Add...

    I assume that the above attempt to define the range in a single entry is the most efficient way, but a quick Google search also turns up numerous less efficient ways to generate individual virtual interface files for each alias

    The first method described in the following article
    https://www.tecmint.com/create-multi...ork-interface/
    The first method (script) described in the following article. If you use this script method, I'd recommend executing it during boot by making it an entry in the /etc/sysctl.conf file
    http://www.linuxscrew.com/2010/11/26...ork-interface/

    For a pretty basic read on using the sysctl.conf file to persist core OS configurations across reboots, you can read an article I wrote a decade ago to modify TCP buffer settings and management starting on the following page, and for the 4 or so pages afterwards. Everything in that article should still apply to all openSUSE today.

    https://sites.google.com/site/4techs...izing/viewinng

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3

    Post Re: How to add IP range as CentOS in OpenSUSE?

    Thank you TSU !

    Let me do it. Thank you!

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: How to add IP range as CentOS in OpenSUSE?

    Cool.
    Remember to post the results of your efforts.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  5. #5
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,593

    Question Re: How to add IP range as CentOS in OpenSUSE?

    @tsu2:
    Am I reading you correctly?

    If a configuration file named "ifcfg-eth0-range0" with content as described by peng_u is placed in '/etc/sysconfig/network/scripts/' then "ifcfg" will, at boot-time, automatically setup IP addresses within the defined range.

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: How to add IP range as CentOS in OpenSUSE?

    Quote Originally Posted by dcurtisfra View Post
    @tsu2:
    Am I reading you correctly?

    If a configuration file named "ifcfg-eth0-range0" with content as described by peng_u is placed in '/etc/sysconfig/network/scripts/' then "ifcfg" will, at boot-time, automatically setup IP addresses within the defined range.
    I think what you described was mentioned first in my post...
    Then followed by a number of other methods which I'd guess all should also work.

    So,
    there are likely many ways to do this...
    The method you describe which is from the CentOS/RHEL/Fedora world assigns alias addresses in an address range similar to setting up a DHCP scope with a start and end address.

    And, considering the similarities between Fedora and SUSE/openSUSE that might not be surprising.

    But,
    For those who might be more comfortable configuring a range using a netmask might consider the next method I suggested.

    And,
    For those who might want something that's more generic across all distros, they might try the last methods I described with those pros/cons.

    IMO,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,593

    Lightbulb Re: How to add IP range as CentOS in OpenSUSE?

    Quote Originally Posted by tsu2 View Post
    The method you describe which is from the CentOS/RHEL/Fedora world assigns alias addresses in an address range similar to setting up a DHCP scope with a start and end address.

    And, considering the similarities between Fedora and SUSE/openSUSE that might not be surprising.
    Looking at the openSUSE Leap 42.3 man page for "ifcfg" revealed the following:
    Code:
    EXAMPLES
           Multiple addresses
    
                  You  can  extend  the  variable name IPADDR by any string you like. For example IPADDR_1, IPADDR-FOO or
                  IPADDRxxx.  Use these variables for your IP addresses.  If you  need  some  additional  parameters  for
                  these  addresses,  then  just  add the same extension to these variable names: BROADCAST, NETMASK, PRE-
                  FIXLEN, REMOTE_IPADDR, LABEL, SCOPE, IP_OPTIONS.
    
                  Example:
                     IPADDR_AAA=1.2.3.4
                     NETMASK_AAA=255.0.0.0
                     BROADCAST_AAA=1.2.3.55
                     IPADDR_BBB=10.10.2.3/16
                     LABEL_BBB=BBB
                     and so on ...
    And, "IPADDR_START", "IPADDR_END", and "CLONENUM_START" are not listed as being valid variables.

    Yes, the synopsis for the openSUSE version of 'ifcfg' is: "/etc/sysconfig/network/ifcfg-*".

    On the other hand, the man page is dated "August 2004" and the copyright is "2004-2015 SUSE LINUX GmbH, Nuernberg, Germany."

    So, we will have to read some code to determine if the Red Hat (Fedora) variables are actually supported by the current openSUSE "ifcfg" implementation, or not.

    Code is fact; Documentation is fiction . . .

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: How to add IP range as CentOS in OpenSUSE?

    @dcurtisfra

    Your post is useful, and I agree.
    Without official documentation, it's hard to state what will definitively work,

    But, I hope my post was complete enough providing a number of tries of which more than likely several are almost guaranteed to work although because they are all a bit different personal preference should determine what should be tried first.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  9. #9

    Default Re: How to add IP range as CentOS in OpenSUSE?

    I have tried to put file ifcfg-eth0-range0 under /etc/sysconfig/scripts as CenOS does. But it doesn't work.

    I'm using OpenSUSE 42.3

    Now I do it manually,

    ip addr add x.x.x.101 dev eth0 label eth0:1
    ip addr add x.x.x.102 dev eth0 label eth0:2
    ip addr add x.x.x.103 dev eth0 label eth0:3
    ip addr add x.x.x.104 dev eth0 label eth0:4
    ip addr add x.x.x.105 dev eth0 label eth0:5
    ip addr add x.x.x.106 dev eth0 label eth0:6
    ip addr add x.x.x.107 dev eth0 label eth0:7
    ip addr add x.x.x.108 dev eth0 label eth0:8
    ....


    as TSU said, I put these commands into /etc/sysctl.conf
    to let it configured before nginx start.

    Maybe in later version OpenSUSE, ip range function can be added.

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: How to add IP range as CentOS in OpenSUSE?

    @peng_u

    Thks for posting your result.
    If you'd like to perhaps see support for the CentOS script method,
    I'd suggest you submit a "feature request" to https://bugzilla.opensuse.org.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •