LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting a second IP address to the same device. (https://www.linuxquestions.org/questions/linux-networking-3/setting-a-second-ip-address-to-the-same-device-322456/)

Ougle 05-11-2005 01:53 PM

Setting a second IP address to the same device.
 
Hi,

I have apache2 running and am playing with virtual hosts and having 192.168.1.255 and 192.168.1.254 (and 192.168.1.253 etc) as two (or more) hosts so that they can point to different websites.

For the virtual hosts to work I have to add the IP address to the ethernet device using the following command.
Code:

/sbin/ifconfig eth0:0 192.168.1.254

But I have to do that before Apache is started.
Is there a way that I can have the computer do that command when it boots up before it starts Apache?

michaelsanford 05-11-2005 02:08 PM

I don't know about SUSE specifically but Slackware has /etc/rc.d/rc.local for local custom startup commands.

Check around for something similar, and put the command there (or wait for someone who knows SUSE to tell you ;) )

Imanerd 05-11-2005 03:40 PM

I only know how to do it graphically, but on FC3 with GDE, you can use system-config-network to add a new (logical) ethernet device and give it any IP address you want. Then just check the box that says, "activate this device when computer starts". But it seems like it would be easier for you to use name based virtual hosting and run all the sites on the same IP address.

Sorry I can't be more helpful, but I'm a newbie at this stuff myself.

Ougle 05-12-2005 05:52 AM

Graphically is good, I am a newbie too :) (although being a programmer I dont mind text if I have instructions)

Ive gone to the YAST control centre and to yast-system-config and looked at most of the settings including the ones in hardware-network.
I think I might have to set a setting to run a script and then go and edit that script.


I'll have another look later but in the mean time anyone who knows SuSE would really help.

fr_laz 05-12-2005 06:31 AM

Hi,

here it is : http://portal.suse.com/sdb/en/2002/0...network80.html
they explain what config files are used at boot time and how to configure them.

as for the alias, have a look at :
http://www.ambidexter.com/unix-model/redhatip.htm

baldy3105 05-12-2005 07:02 AM

Don't configure a host with 192.168.1.255, this is a broadcast address for the 192.168.1.0 network and you will get all sort of weirdities if you attempt to connect to it.

Ougle 05-12-2005 12:09 PM

Thanks, those links helped and I made my config file needed. It works great, I got to see it set the IP address as I watched it quickly boot up everything.

I did relise later that 192.168.1.255 was my broadcast address and not my default IP address as I had thought. Thanks for the warning though pete.


All times are GMT -5. The time now is 03:29 PM.