# vhost with multi IPs



## evgeni22 (Dec 10, 2010)

hi
i have 4 ip`s and want to connected them to 1 box
i need to do vhost for irc services like eggdrop or psybnc
but when i put differnt ip that not get vhost and get into irc with same ip
i try even connected 4 interfaces for one box and even that not help me
but when i change forward port in router like 22 for ssh for else ip that get into 
that i mean he reconize all ips but not show me vhost on irc
any idea what i should to do?


----------



## codeWarrior (Dec 11, 2010)

Every NIC has a primary or "base" IP address... all other addresses are "aliases" -- so you first need to make sure you are aliasing your additional IP's. I have a machine running 32 IP addresses -- the base IP address and 31 virtual IP addresses... 

If your IP addresses are public -- you will need to makes sure that your provider has assigned them to you in your IP block. If you are doing this on a private or internal network -- no problem. 

There's also some information in the FreeBSD diaries that you might find useful: http://www.freebsddiary.org/ip-address-change.php

Make sure you use aliases for your additional IP addresses [_in /etc/rc.conf -- you should see something similar to this:_]

*Make sure you use YOUR IP addresses and NIC [mine is vr0] in your rc.conf ... not mine ! *


```
# BASE IP ADDRESS:
ifconfig_vr0="69.46.43.66 netmask 255.255.255.224"

# ADDITIONAL IP ADDRESSES:
ifconfig_vr0_alias0="inet 69.46.43.67 netmask 255.255.255.224"
ifconfig_vr0_alias1="inet 69.46.43.68 netmask 255.255.255.224"
ifconfig_vr0_alias2="inet 69.46.43.69 netmask 255.255.255.224"
ifconfig_vr0_alias3="inet 69.46.43.70 netmask 255.255.255.224"
```

apply the IP configuration and make sure that ALL of your IP addresses are visible and attached to the machine: [obviously: substitute YOUR IP addresses]

[CMD=]ping 192.168.1.25[/CMD]

*Once all of your IP addresses are resolving to the correct machine -- you should be able to do your IP-Based virtual hosting*


----------



## JohnR (Dec 15, 2010)

I think what the original poster means is, he has four IP's each with their own DNS. He wants the outgoing connection to some IRC server to always use a specific IP / Hostname. If this is the case, I think it would be easiest to jail the process and force it to a specific IP that way.


----------



## DutchDaemon (Dec 15, 2010)

Note: IP aliases in the _same_ subnet must have a 255.255.255.255 netmask.


```
man ifconfig | less +/"     alias"
```


----------



## jalla (Dec 15, 2010)

DutchDaemon said:
			
		

> Note: IP aliases in the _same_ subnet must have a 255.255.255.255 broadcast address.
> 
> 
> ```
> ...



If you change that to netmask I'll agree with you


----------



## DutchDaemon (Dec 15, 2010)

Heh, excusez-moi


----------

