I was given a second IP by my server provider. I am running Debian 5.0. I thought I knew how to add the IP to the system and configure with apache, but I have not yet been able to.
The primary IP works fine and I have a few sites already running on that one.
What steps would I take to add this second IP so that I use it in apache?
-
You are supposed to configure a new alias for your second ip.
The mandatory resources for ip management are the file /etc/network/interfaces and the ip tool from iproute package.
Where are things breaking? what doesn't work?
From scyldinga -
Assuming the new IP address is on the same subnet as the first, add a second virtual interface (sometimes called an "alias") to the primary network interface. This is configured, like all network interface settings, in
/etc/network/interfaces
. The Debian Reference manual has a section on the topic:http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#%5Fthe%5Fvirtual%5Finterface
A simple example, assuming your primary network interface is
eth0
and has an ip of192.168.1.1
and the new ip is192.168.1.2
:auto eth0 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.254 auto eth0:0 iface eth0:0 inet static address 192.168.1.2 netmask 255.255.255.0
Once the appropriate settings have been added to
/etc/network/interfaces
, runifup eth0:0
to activate the new interface.If, however, the new ip is on a different subnet, you need to either provision the ip on a physically distinct network interface or create a VLAN interface, depending on how your ISP is prepared to hand it off to you. That's a whole new topic.
David : Thanks for the answer. I tried following these instructions, but when I restart the network interfaces I receive this error: :/etc# /etc/init.d/networking restart Reconfiguring network interfaces...SIOCDELRT: No such process if-up.d/mountnfs[eth0]: waiting for interface eth0:0 before doing NFS mounts (warning). done. The subnet is the same for the ips, so from what I know and read this above solution should work. The virtual host that I setup are not working and I get network timeout on the domain.Insyte : The warnings sound reasonable. The fact that it makes reference to waiting for eth0:0 is good news. What do your network interfaces look like after restarting networking? Specifically, what does the output of "`ifconfig -a`" look like?From Insyte -
If you use the
iproute
package, you can put this in/etc/network/interfaces
:auto eth0 iface eth0 inet static address 10.0.0.17 netmask 255.0.0.0 gateway 10.0.0.1 up ip addr add 10.0.0.18 dev eth0 down ip addr del 10.0.0.18 dev eth0
From hop -
Even Simpler:
Use an "addresses" line in /etc/network/interfaces
iface eth1 inet static address 10.10.0.66 netmask 255.255.255.240 network 10.10.0.64 broadcast 10.10.0.79 gateway 10.10.0.65 addresses 10.10.0.67/28 10.10.0.67/28 10.10.0.68/28
You can use a space seperated list of IPs/CIDR netmasks.
This is a crippled version of my interface definition (IPs changed and only relevant part)
0 comments:
Post a Comment