Results 1 to 10 of 10
  1. #1
    Join Date
    May 2009
    Location
    Greece
    Posts
    1,008

    Talking How can i add a second ip on my Centos server?

    Hello

    I am very confused about second ip routed on a dedicated server a on the last 2-3 datacenters that i got a dedicated server i just ask for a second ip routed on my server and they just add it without accessing my server and i was able to ping it and use it as ns2.

    I got one server a few days ago from online.net and i got 1 ip and i ask for a second ip routed on my server and they told me to get one failover ip and add it on my server from the client panel.

    I did it but i was not able to ping or use that ip so i contact them and they told me to create a file:

    Code:
    /etc/sysconfig/network-scripts/ifcfg-eth0:0
    as i did and i add all the info there...

    Then when i try to run ifup eth0:0 or service network restart i got this:

    Code:
    eth0:0 is not present, initialization will be delayed
    Then i just check on the path /etc/sysconfig/network-scripts/ and no eth0 file is there... and my main server ip was on a file named em1...

    Any ideas how can i fix this so i can ping that ip?

    if i run ifconfig i can see the em1 only interface that is working using main sever ip and lo ...

    Thank you

  2. #2
    Try ifcfg-em1:0

    Dale

  3. #3
    Join Date
    May 2009
    Location
    Greece
    Posts
    1,008
    ifcfg-em1:0 file does not exist...

    On that folder i have :

    ifcfg-em1
    ifcfg-em2

    Maybe to edit the ifcfg-em2 and try to load this or better to create a new ifcfg-em3 file?
    Last edited by hostyourdream; 01-28-2014 at 04:51 PM.

  4. #4
    you need to create the file (ifcfg-em1:0) and add this:

    IPADDR="your new ip here"
    NETMASK="your subnet mask here"
    NETWORK="your network ip here"
    BROADCAST="broadcast ip"
    BOOTPROTO="static"
    DEVICE="em1:0"
    TYPE="Ethernet"
    ONBOOT="yes"


    ifup em1:0

  5. #5
    Join Date
    May 2009
    Location
    Greece
    Posts
    1,008
    I edit the ifcfg-em2 and now is working

    But this was for a private ip that i was not need anyway .....

    But i am wondering if it is possible to add a third ip now as the em1 and em2 was there and when i add any new is not working.... ?

  6. #6
    Yep... use a sub interface as i suggested above. You can have multiple ip's on the same nic. As long as em1 or em2 are on the correct network, you should be good.

  7. #7
    Join Date
    Sep 2008
    Location
    Seattle, WA
    Posts
    1,268
    Quote Originally Posted by WLH-Dale View Post
    Yep... use a sub interface as i suggested above. You can have multiple ip's on the same nic. As long as em1 or em2 are on the correct network, you should be good.
    em1 and em2 are the nic files and you put the basic config in there, you use em1:0

    You can also use a range file such as:

    vi /etc/sysconfig/network-scripts/ifcfg-em1-range0

    IPADDR_START=192.168.1.1
    IPADDR_END=192.168.1.200
    CLONENUM_START=10
    █ Brian Kearney, Stealthy Hosting Inc. Seattle, WA [AS54931] Skype: StealthyHosting
    Affordable Dedicated Servers
    Remote Hands Colocation

    █ Email: [email protected] Phone: 253-880-1233

  8. #8
    Join Date
    May 2009
    Location
    Greece
    Posts
    1,008
    Great info !

    Is it better to use range ip's option in one file or to use ifcfg-em1:0 and ifcfg-em1:1 and ifcfg-em1:2 ?

    Thanks all of you

  9. #9
    Join Date
    Oct 2002
    Location
    Vancouver, B.C.
    Posts
    2,656
    Quote Originally Posted by hostyourdream View Post
    Is it better to use range ip's option in one file or to use ifcfg-em1:0 and ifcfg-em1:1 and ifcfg-em1:2 ?
    It's better to use the range file if the IP addresses are contiguous, so you don't have to do as much configuration. You can also have multiple range files if need be.

    By the way, if the IP's are routed to you, it doesn't matter what interface the IP's are bound to, they will still work. It's better to stick to em1 which is the interface you receive the packets on though, to keep the configuration clean.

    You may also want to use a subnet mask of 255.255.255.255, to ensure that outbound traffic uses your primary IP address. It varies from kernel/distro, but sometimes the most recently configured IP address ends up being used by default on outbound traffic.
    ASTUTE HOSTING: Advanced, customized, and scalable solutions with AS54527 Premium Canadian Optimized Network (Level3, PEER1, Shaw, Tinet)
    MicroServers.io: Enterprise Dedicated Hardware with IPMI at VPS-like Prices using AS63213 Affordable Bandwidth (Cogent, HE, Tinet)
    Dedicated Hosting, Colo, Bandwidth, and Fiber out of Vancouver, Seattle, LA, Toronto, NYC, and Miami

  10. #10
    Join Date
    May 2009
    Location
    Greece
    Posts
    1,008
    ok which of these are not needed if i want to use the em1:0 as a ns2.mydomain.com ip entry?


    DEVICE="em1"
    BOOTPROTO="static"
    DNS1=127.0.0.1
    GATEWAY="servergateway"
    HOSTNAME="noname"
    HWADDR="D4:WE:5Z0:6C:7Z"
    IPADDR="secondserverip"
    IPV6INIT="yes"
    MTU="1500"
    NETMASK="255.255.255.0"
    NM_CONTROLLED="yes"
    ONBOOT="yes"
    TYPE="Ethernet"

    Thank you

Similar Threads

  1. How to add and remove users on CentOS 6.
    By rogriverac in forum VPS Tutorials
    Replies: 4
    Last Post: 06-09-2013, 02:03 PM
  2. Howto add IP permanently to your dedicated CentOS server?
    By pj1s in forum Hosting Security and Technology
    Replies: 6
    Last Post: 04-03-2012, 07:08 PM
  3. Is there any way to add mppe to centos? please help!
    By kagetu_toki in forum VPS Hosting
    Replies: 1
    Last Post: 06-17-2010, 08:36 AM
  4. add 2 range ip in linux centos
    By robocap in forum Hosting Security and Technology
    Replies: 5
    Last Post: 07-06-2008, 05:31 PM
  5. How to add an IP adress to CentOS server?
    By Rafal_A in forum Hosting Security and Technology
    Replies: 1
    Last Post: 05-08-2007, 04:10 PM

Posting Permissions

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