# Virtual IP's? [SOLVED]

## FnkDrSpok

My server hoster gave me 5 additional IP's for my server that are public IP's. They all have a netmask of 255.255.255.255 and I want to add them to my main NIC interface on my server. I don't want to make too many changes to /etc/conf.d/net and bring my server down remotely. I would like some help on how I would set up the additional public IP's for my server. I know normally you would indicate that it's a virtual IP by putting iface_eth0:1 but is that correct with gentoo? Also, should I use the 255 netmask?

Also, I'm very new to webservers, I'm just good at administrating them. Is there some sort of guide that I can read and use as a reference when it comes to Mail Servers, Web Servers, Iptables basics and TCP Wrappers? Any help here would be appreciated.

----------

## ansient

from /etc/conf.d/net.example (you may need to upgrade to the latest ~ keyworded baselayout)

```
# If you need more than one address, you can use something like this

# NOTE: ifconfig creates an aliased device for each extra IPv4 address

#       (eth0:1, eth0:2, etc)

#       iproute2 does not do this

#config_eth0=(

#   "192.168.0.2/24"

#   "192.168.0.3/24"

#   "192.168.0.4/24"

#)
```

----------

## Insanity5902

I like iproute2, so I use it for my net.* scripts, here is my /etc/conf.d/net

 (the ips have been changed for my peace of mind)

```
modules=( "iproute2" )

config_eth0=( "10.0.0.2/25 brd 10.0.0.127" )

config_eth1=( "10.0.0.3/25 brd 10.0.0.127"

                "10.0.0.10/25 brd 10.0.0.127"

                "10.0.0.11/25 brd 10.0.0.127"

                "10.0.0.12/25 brd 10.0.0.127"

                "10.0.0.13/25 brd 10.0.0.127"

                "10.0.0.14/25 brd 10.0.0.127"

                "10.0.0.15/25 brd 10.0.0.127"

                "10.0.0.16/25 brd 10.0.0.127" )

config_eth2=( "10.0.0.4/25 brd 10.0.0.127" )

routes_eth0=( "default via 10.0.0.1" )

routes_eth1=( "default via 10.0.0.1" )

routes_eth2=( "default via 10.0.0.1" )
```

----------

## FnkDrSpok

 *ansient wrote:*   

> from /etc/conf.d/net.example (you may need to upgrade to the latest ~ keyworded baselayout)
> 
> ```
> # If you need more than one address, you can use something like this
> 
> ...

 

What do you mean "(you may need to upgrade to the latest ~ keyworded baselayout)"? I'm still not sure how I go about setting up other public IP's on my server. Do I just type it in like you state above? If I had the box here I would test it with no problem but I don't want to jack something up and totally use my remote connectivity and have to call my data center to fix my error.

----------

## FnkDrSpok

Also, after looking at my /etc/conf.d/net file I notice they talk about aliases. Is that where I need to enter my other IP's for my NIC. 

```
# For adding aliases to a interface

#

#alias_eth0="192.168.0.3 192.168.0.4"
```

----------

## ansient

 *FnkDrSpok wrote:*   

> Also, after looking at my /etc/conf.d/net file I notice they talk about aliases. Is that where I need to enter my other IP's for my NIC. 
> 
> ```
> # For adding aliases to a interface
> 
> ...

 

That is the old method.  The new baselayout is better.

```
mkdir /etc/portage

echo sys-apps/baselayout >>/etc/portage/package.keywords

emerge --sync && emerge -a baselayout
```

Then run etc-update or dispatch-conf.  Be careful with these tools.

----------

## FnkDrSpok

Another question, when doing an etc-update, is it safe to do a -5  

```
Please select a file to edit by entering the corresponding number.

              (don't use -3 or -5 if you're unsure what to do)

              (-1 to exit) (-3 to auto merge all remaining files)

                           (-5 to auto-merge AND not use 'mv -i'):
```

----------

## screwloose

-5 is only sure if your ABSOLUTELY sure that the files its going to change are ones you haven't edited in the past. I usually go through the list and manually merge the ones that I know have changed and -5 the rest.  

Make sure you look real carefully which files it is going to change because you really don't want it to overwrite something important like your /etc/fstab.

----------

## ansient

or /etc/groups,shadow,passwd...

----------

## FnkDrSpok

But if you merge, that doesn't exactly overwrite the file right? That just adds to it or am I interpreting it wrong?

----------

## screwloose

Most of the time etc-update seems to just overwrite a file when it does a -5. I think I have seen a couple apps do what you would expect a proper merge to be but they seem to be the minority.  I really recommend updating manually most of the time. Just do a forum search for "fstab etc-update" and see how many people have had problems from blindly using -5.

----------

## UberLord

 *ansient wrote:*   

> or /etc/groups,shadow,passwd...

 

baselayout no longer installs those files if they are already present as too many users were doing this .... heh

----------

## ansient

 *UberLord wrote:*   

>  *ansient wrote:*   or /etc/groups,shadow,passwd... baselayout no longer installs those files if they are already present as too many users were doing this .... heh

 

Awesome, I always considered it a design flaw.  You should do this for fstab, too  (if a change needs to be made, use an einfo)

----------

## UberLord

 *ansient wrote:*   

> 
> 
> Awesome, I always considered it a design flaw.  You should do this for fstab, too  (if a change needs to be made, use an einfo)

 

We already do

----------

## screwloose

 *UberLord wrote:*   

>  *ansient wrote:*   or /etc/groups,shadow,passwd... 
> 
> baselayout no longer installs those files if they are already present as too many users were doing this .... heh

 

Awwww I enjoyed reading the "I borked my system with etc-update" posts that were very common after a baselayout update. :Twisted Evil: 

Actually I think it shows that Gentoo is maturing that one of the most common user problems is no longer an issue. Hats off to whoever finally put that check in place. :Very Happy: 

----------

## dashnu

sombody please help me figure this out... Using iproute2 in my /etc/conf.d/net i have this...

```
modules=( "iproute2" )

config_eth1=( "192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" )

config_eth0=(

        "XX.XX.XX.10 netmask 255.255.255.248 broadcast XX.XX.XX.15"

        "XX.XX.XX.11 netmask 255.255.255.248 broadcast XX.XX.XX.15"

        "XX.XX.XX.12 netmask 255.255.255.248 broadcast XX.XX.XX.15"

        "XX.XX.XX.13 netmask 255.255.255.248 broadcast XX.XX.XX.15"

        "XX.XX.XX.14 netmask 255.255.255.248 broadcast XX.XX.XX.15"

)

```

However only the .10 and .11 resolve WHY IS THIS?

----------

## Martz

 *dashnu wrote:*   

> sombody please help me figure this out... Using iproute2 in my /etc/conf.d/net i have this...
> 
> ```
> modules=( "iproute2" )
> 
> ...

 

You have the broadcast address wrong I believe. It should be xx.xx.xx.248 at a guess.

You have a /29 routable address block right? 8 IPs?

----------

## dashnu

man i wasted so much time on this... I decided to unplug the modem and plug it back in and it worked.. wtf! must have been something with my isp. Thanks anyways

----------

## splooge

 *Martz wrote:*   

>  *dashnu wrote:*   sombody please help me figure this out... Using iproute2 in my /etc/conf.d/net i have this...
> 
> ```
> modules=( "iproute2" )
> 
> ...

 

just fyi... 10.x.x.8 is his network, 9-14 are the usable ip's, 15 is hte broadcast.

----------

## dashnu

ya know I have no idea how to figure that out.. I need to read up on basic networking I guess  :Razz: 

But I have 5 usable ips 10 - 14 and my broadcast is 15..

----------

