Adding virtual interface for IP based virtual host
Hello
I'm planning to setup an IP based virtual host in apache. current system IP: 192.168.1.5 Add ip of 192.168.1.10 by adding a virtual ifconfig eth0 add 192.168.1.10 Add a second ip 192.168.1.20 ifconfig eth0:1 add 192.168.1.20 Is this correct? And would the virtual interfaces remain intact after a reboot? If not, how would I go about making them permanent? Thanks. |
Quote:
I don't know how to tell you to make them persistent because i don't know which distro you are using. |
Is this on a Red Hat or CentOS type system? To make them permanent, just create the ifcfg-eth0:1 and other ones according to the device you created and put these files in /etc/sysconfig/network-scripts
|
Sorry, it's Ubuntu 7.10.
And should I be doing eth0:1 for the first virtual interface and eth0:2 for the second instead of eth0 and eth0:1? Do I need to add the virtual IPs to /etc/hosts file? Thanks. |
Quote:
If this is just a local test and you do want to have some type of name resolution, then yes, add them to /etc/hosts if you have no other DNS setup on your network. And sorry, not Ubuntu user, not sure what files to stick the configurations in to survive a reboot and I'm too lazy to go searching cause I'm not a personal search engine, I'm sure if you tried searching yourself, you'd find the answer rather quickly. |
You will have to put them in /etc/network/interfaces
|
Would this work?
iface eth0:1 inet static address 192.168.1.5 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 iface eth0:2 inet static address 192.168.1.10 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 iface eth0:3 inet static address 192.168.1.20 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 |
All times are GMT -5. The time now is 11:22 AM. |