Multiple IP's on one nic not working

Discussion in 'Server Operation' started by cvgeeks, Jun 8, 2010.

  1. cvgeeks

    cvgeeks New Member

    Hello all,

    I have waited to post this as I wanted to ensure I tried everything I could to ensure as legit a post as possible and without posting whats already been posted.

    I have a problem with multiple ip's on one nic. I'm running Fedora12 with ISPConfig 2. My server has been running fine for about a year now and I have a customer who would like a website with it's own SSL.
    I understand that I will need a dedicated IP for this and that I have. I also understand that I need to add a virtual IP to eth0 and that I did. I followed the instructions given at: http://www.howtoforge.com/perfect-server-centos-5.3-x86_64-ispconfig-2-p3 and to my dismay it works after I restart the network and until the server is rebooted and then eth0 takes the ip on eth0:0 and binds it to eth0.

    Heres what I did maybe I'm doing somthing wrong:

    cp ifcfg-eth0 ifcfg-eth0:0
    vi ifcfg-eth0:0
    changed the DEVICE: from eth0 to eth0:0
    changed IP
    saved and exit.
    Restarted network
    ifconfig all is good it now shows
    eth0 bound to the proper ip
    eth0:0 bound to the proper ip

    then I reboot the server when it comes up ifconfig shows

    eth0 bound to the newly added ip given to eth0:0 and eth0:0 no longer shows up.

    I have searched and searched and I just can't seem to understand why eth0 is doing this.

    Seems I'm doing somthing wrong for sure just don't know what! Any help would be greatly appreciated and thanks in advance.
     
  2. cvgeeks

    cvgeeks New Member

    Ok, I've been researching all night and here is what I have come up with.

    I need to add:
    ifconfig eth0:0 xxx.xxx.xxx.xxx netmask yyy.yyy.yyy.yyy up

    to the /etc/rc.local file so that the settings will be reapplied to the servers nic upon reboot.

    I added:
    ifup eth0:0 to the /etc/rc.local file instead. Looks like maybe I'm using the wrong command :D) - Oops!

    I'll try this solution out today when I get in the datacenter as I do not have access to the machine at this point as I rebooted it last night and it's nolonger online ;(

    I'll keep you up to date if this works.

    Thanks.
     
  3. cvgeeks

    cvgeeks New Member

    Ok, I'm stumped! I added the correct line to the rc.local file and still the eth0:0 virtual ip gets used by eth0 upon reboot.
    All works fine when I restart the network but upon a reboot the eth0:0 ip gets used by eth0 and I end up not having eth0:0.

    Any help would be appreciated. :confused:
     
  4. cvgeeks

    cvgeeks New Member

    Ok, I got it! My issue was not in the way I was setting it up my issue turned out to be that NetworkManager was controlling the nics upon each reboot so it needed to be turned off. WoW!

    So incase anyone wants to know how I did what I did:

    1. cd /etc/sysconfig/network-scripts
    2. cp ifcfg-eth0 ifcfg-eth0:0
    3. vi ifcfg-eth0:0
    ---------------Contents of the file ifcfg-eth0:0---------------------
    DEVICE=eth0 <--change from eth0 to eth0:0 this sets your virtual interface--<<
    BOOTPROTO=static <--This says your ip is static not dynamic--<<
    DNS1=192.168.1.5 <--Enter your primary dns servers ip address here--<<
    GATEWAY=192.168.1.1 <--Your gateway addy here --<<
    IPADDR=192.168.1.2 <--Change from old IP (to) new IP--<<
    NETMASK=255.255.255.0 <--Should stay the same in most cases--<<
    TYPE=Ethernet
    ONPARENT=yes
    NM_CONTROLLED=yes <--This was my downfall so I turned NetworkManager off.
    IPV6INIT=no
    USERCTL=no
    PREFIX=28
    DEFROUTE=yes
    NAME="System eth0" <--Change from "System eth0" (to) System eth0:0--<<
    UUID=81bc1da6-9516-a6bf-93g7-613092a810b1
    ONBOOT=yes
    HWADDR=00:11:85:5b:56:9A
    --------------------------------End of file ---------------------------

    :How to turn off network manager:

    #chkonfig NetworkManager off
    #chkconfig network on
    ----------------------------------------------------------------------
    Now we need to modify /etc/rc.local to start eth0:0 everytime the server reboots otherwise the settings will not take affect.

    vi /etc/rc.local
    -------------------Contents of rc.local--------------------------------
    #!/bin/sh
    #
    # This script will be executed *after* all the other init scripts.
    # You can put your own initialization stuff in here if you don't
    # want to do the full Sys V style init stuff.
    ifup eth0:0 <--We add this pointer to the virtual interface--<<
    ~
    ~
    ~
    ~
    ----------------------End of rc.local
    Now save and exit:
    restart the server
    bang! Your up and running with multiple ips on a single nic. Sweet!
     
  5. cvgeeks

    cvgeeks New Member

    Feeling kinda silly right now...

    I figured it out however I also just figured out that ISPConfig 2 has a feature called Automatic Networking which is really neat I might ad and what it does is everything I did above simply by turning this feature on which is off by default I learned and then entering your new ip address in the server control panel.

    To turn this fantastic feature on simply use vi to edit this file:
    /home/admispconfig/ispconfig/lib/config.inc.php

    You can do a search for network_config and it should take you to this line in the file:
    $go_info["server"]["network_config"] = 0; // 0 = none, 1 = automatic
    Now change the 0; to a 1; - thats the zero after the equals sign only.

    Now reboot and enter your ip's in the control panel.

    You can ssh into your server and run ifconfig to see a list of devices and their respective ip's bound to them. You should see a new eth0:0 with your new ip bound to it. Seems ISPConfig sets up the netmask and gateways according to your existing eth0 setttings.

    Hope this helps someone out their :D)
     
  6. cvgeeks

    cvgeeks New Member

    Solved!!!!

    I have been trying to get multiple IP's working on one nic for about a week now due to one of my customers needing a SSL. So I tried everything step by step and kept running into blocks and it turned out to be my GLUE RECORDS or Host Records not entered in my DNS as well as no Reverse Pointer Records. So once I was told to fix my glue records I did my home work and found out that my dns was not properly configured.
    I ended up doing a fresh install of ISPCONFIG and Fedora then setup all my glue records then enabled automatic networking and turned off NetworkManager then restarted the server then entered the second ip in ispconfig. Then made all my glue records and pointers (maybe their the same) hehe, and then restarted the server. BANG!!!! It was up and running and all my sites were pinging, digging, configing hahaha soooo happyyy now!!!

    Hope someone out their having this issue learns a little from this as it is a difficult issue to overcome.


     

Share This Page