Re: binding 2 or more IP addresses to one interface?
On Tue, 16 Nov 2004 15:32:22 +1100
Ivan Wills <ivan@apollolifesciences.com> wrote:
> Hi
> I want to set up apache with some virtual hosts with different IP
> addresses and only have one NIC in the machine. Does any know how to
> bind more than one IP address to a NIC?
It's pretty easy, actually. Assuming your NIC is eth0 and you have a
static ip, just copy the section for eth0 and make the new section
eth0:0. Like so:
auto eth0
iface eth0 inet static
address 333.162.214.60
netmask 255.255.255.0
network 333.162.214.0
broadcast 333.162.214.255
gateway 333.162.214.1
auto eth0:0
iface eth0:0 inet static
address 333.162.214.61
netmask 255.255.255.0
network 333.162.214.0
broadcast 333.162.214.255
(Yes, I realize I used an invalid ip. This is just an example.) Now just
restart your network interfaces by doing a "/etc/init.d/networking
restart" and you should be good to go.
HTH,
Jacob
Reply to: