# multiple ip's on the same computer

## wizy

I have 8 ips that I would like to put on 1 system. To offer the few shell users I have more hosts to irc and other things from.  I know its going to be alias's for my eth0, something like eth0:1 through 7 (eth0 being the first one.) But I have never actually done this before.  What is the 'gentoo' way to do this? I imagine it should be done in the net.eth0 script.  Any help is appricaited.

----------

## klieber

Look at /etc/conf.d/net.  There's a section in there for adding aliases to an eth interface. 

--kurt

----------

## wizy

Thank you for the help.

----------

## roman

There is "possibly" bug in gentoo, 'cause as ip aliasing howto says, you

must add route for each aliased card so:

```
/sbin/route add -host <first ip> dev eth0

/sbin/route add -host <second ip> dev eth0:0

/sbin/route add -host <third ip> dev eth0:1

etc...
```

I've added it to /etc/conf.d/local.start and now all works nicely

Roman.

----------

## wizy

it has:

#alias_eth0="192.168.0.3 192.168.0.4"

and

#broadcast_eth0="192.168.0.255"

#netmask_eth0="255.255.255.0"

I have 7 more ip's I want to add to this computer.  Ive got the main ifconfig lines setup. they work fine with the first ip.  What do I do here to put the other 7 in. I mean, what is the .3 and the .4 is the .3 the eth0 ip and the .4 the new alias?

----------

## klieber

 *wizy wrote:*   

> #alias_eth0="192.168.0.3 192.168.0.4"

 

Change that to:

```
alias_eth0="192.168.0.3"

alias_eth0:1="192.168.0.4"
```

and it *should* work.  Away from my Gentoo box at the moment, so I can't test it.  

--kurt

----------

## wizy

But the ip for eth0 is set on the main ifconfig line up above? do I need to set that again?

----------

## klieber

 *wizy wrote:*   

> But the ip for eth0 is set on the main ifconfig line up above? do I need to set that again?

 

No -- just set it once.  alias_eth0 should be your second IP address, alias_eth0:1 your third, and so on.  (again, I haven't tested anything beyond two IPs on the same computer, so please let us know if this works)

--kurt

----------

## wizy

Its easier than all of that

```
alias_eth0="IP IP IP IP"
```

It is a space separated list of ip's to create alias's from.  So that one above would create eth0:0 eth0:1 eth0:2 and eth0:3 each with those ip's specified in the space delimited variable.  Quite simple now that ive got it working.  I like gentoo more and more every time I find something like this.

----------

