[SOLVED] Auto-Up Virtualhosts?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help

[SOLVED] Auto-Up Virtualhosts?

Postby derrend on Mon Nov 26, 2012 3:59 pm

I'm sorry for posting this into the forum because I know it's plastered all over the internet but I'm just not able to grasp it for some reason soplease someone spell it out for me:-

I host a folder on a virtualhost 192.168.0.101
How can i make this virtualhot run at startup?

I edited the /etc/network/interfaces and added
iface eth0:1 inet static
address 192.168.0.101

and when i run 'ifup eth0:1' it works fine but how do i get the computer to do this at boot?

i put the command into a script in '/root/virtualup.sh'
and edited root crontab with '@reboot /root/virtualup.sh' the script ran fine when i tested it but this didn't happen at startup
so I changed it to '@reboot ifup eth0:1' but this didn't work either.

then i put 'ifup eth0:1' into '/etc/rc.local' but that didn't work.

Please note the '' around the commands are for illustration and not part of the command. im using mint 14 nadia :)

**I've now also tried putting 'eth0:1' in the auto line at the top of the 'interfaces' file.
and also put the line 'dhclient eth0:1' in 'rc.local' but still no luck.

Just tried 'sudo /etc/init.d/networking restart' and 'sudo service network-manager restart'.
eth0:1 showed up but the desktop interface went funny so i rebooted the computer which put it back to normal but still no eth0:1 at startup.

could network manager be the problem?

ok final update and then off to bed,
i added 'echo it worked >> /path/to/home/success.txt' below the command 'ifconfig eth0:1 192.168.0.101'.
The text file showed up in my home folder but the host was not cofigured, why could this be??
Last edited by derrend on Fri Nov 30, 2012 5:33 pm, edited 1 time in total.
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Linux Mint is funded by ads and donations.
 

Re: Auto-Up Virtualhosts?

Postby derrend on Tue Nov 27, 2012 2:18 pm

*BUMP, I have a sneeky feeling my question isn't getting traffic now its slipped to page two. Surely someone out there can tell me why ifup commands dont work at boot??
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: Auto-Up Virtualhosts?

Postby DrHu on Tue Nov 27, 2012 2:26 pm

Some network cards (nics) detect on power changes: IBM used to be like that: so I would use both ifdown and ifup to get a status reset to the card
--see if that sequence gets the nic active..
http://www.computerhope.com/unix/ifup.htm

But since it is a virtualhost and would be using the local (real host) devices, specifically networking, then..
http://www.webnms.com/simulator/help/si ... al_ip.html
http://www.boutell.com/lsm/lsmbyid.cgi/001134
    linuxconfg tool referenced in the link below..
--check the names (aliases..) being used for that device on the virtualhost..
User avatar
DrHu
Level 17
Level 17
 
Posts: 7006
Joined: Wed Jun 17, 2009 8:20 pm

Re: Auto-Up Virtualhosts?

Postby derrend on Tue Nov 27, 2012 8:01 pm

Thanks for the advice but im still having no luck,
I configured the eth0:1 interface in /etc/network/interfaces and then in the rc.local file placed the command 'ifdown -a' 'ifup -a' and 'echo this script ran fine >> /home/folder/file'.
I tested 'ifdown -a' and 'ifup -a' manually which brought up the interface fine and when the computer reboots the output from echo shows up in my home folder which means the two commands above it ran fine because of the -e option after #!/bin/bash doesn't it?

I cant figure out why the interface isn't showing if the commands are running? Am i being overridden somehow perhaps?

Thanks in advance :)
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: Auto-Up Virtualhosts?

Postby derrend on Thu Nov 29, 2012 9:03 am

*Bump - C'mon fellow linux enthusiasts im waiting 24 hours betwen bumps and i think this is my last one, surely someone out there knows why commands relating to ifconfig and network interfaces aren't having an effect from the rc.local file? It worked in mint 13 im sure of it.
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: Auto-Up Virtualhosts?

Postby Gord on Thu Nov 29, 2012 5:05 pm

I dunno, this /etc/network/interfaces file works for me in Mint 14 Cinnamon:
Code: Select all
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
   address 192.168.1.14
   netmask 255.255.255.0
   gateway 192.168.1.1
   dns-nameservers 192.168.1.1

auto eth0:1
iface eth0:1 inet static
   address 192.168.1.15
   netmask 255.255.255.0

When I boot it just works, I don't need to do ifup or mess around with rc.local .

However, the network indicator in the status bar says "no connection" and when I click on it it says "Wired unmanaged" so the although the interface _is_ working (i can ping 1.14 and 1.15 from another box) the network manager doesn't recognize the connection. I'm very new to this Mint business so I don't really know why that might be. If somebody else here could explain the "proper" (i.e., managed) way to do it I'd be interested to learn.
Gord
Level 1
Level 1
 
Posts: 46
Joined: Fri Nov 23, 2012 5:14 pm
Location: Canada

Re: Auto-Up Virtualhosts?

Postby derrend on Fri Nov 30, 2012 5:32 am

Gord wrote:I dunno, this /etc/network/interfaces file works for me in Mint 14 Cinnamon.

Have you by any chance uninstalled network-manager?
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: Auto-Up Virtualhosts?

Postby Gord on Fri Nov 30, 2012 6:06 am

derrend wrote:
Gord wrote:I dunno, this /etc/network/interfaces file works for me in Mint 14 Cinnamon.

Have you by any chance uninstalled network-manager?

Nope,

Code: Select all
gord@CinnaMintVM01 ~ $ aptitude search "?name(network-manager$)"
i   network-manager   - network management framework (daemon and userspace tools)

'i' = installed
Gord
Level 1
Level 1
 
Posts: 46
Joined: Fri Nov 23, 2012 5:14 pm
Location: Canada

Re: Auto-Up Virtualhosts?

Postby derrend on Fri Nov 30, 2012 2:12 pm

No exaduration, ive been dealing with this for more than 7 hours today, all ive done is change config settings, add scripts and reboot but it is simply impossible to get the eth0:1 virtual ip to run at boot.

I disabled network-manager and set up the interfaces manually but even that didnt work. I placed commands in the rc.local such as 'sleep 3m; ifconfig eth0:1 192.168.0.100' or told it to sleep and then run a script containing the commanad but it never shows up. If you run the ifup eth0:1 command the shell reports that the interface is 'already configured' but it doesnt show in the ifconfig output and you cant ping it.

I'm saying BUG and giving up. Thanks for the suggestions fellas, hopefully I'll come across the answer at some point in the future.
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: Auto-Up Virtualhosts?

Postby Gord on Fri Nov 30, 2012 2:40 pm

Bummer. FWIW, I think I just found the "managed" way to do it. In Mint 14 Cinnamon, I removed everything from the 'interfaces' file except for the 'lo' (loopback) adapter, then...

Menu > Preferences > Network

...clicked the "Options..." button for the "Wired" connection, then on the "IPv4 Settings" tab selected "Method: Manual", entered both IP addresses and specified the DNS server (settings the same as my old 'interfaces' file, above).

After I rebooted both IP addresses (1.14 and 1.15) responded to pings, even if I was not logged in. After I logged in the status bar icon said that I was connected, and clicking the icon produced the little dialog with "Wired" and the on/off switch (instead of "unmanaged").
Gord
Level 1
Level 1
 
Posts: 46
Joined: Fri Nov 23, 2012 5:14 pm
Location: Canada

Re: Auto-Up Virtualhosts?

Postby derrend on Fri Nov 30, 2012 5:33 pm

Congratulation Gord you've finally solved it! I am a bit disappointed that this method doesn't show in the ifconfig output so I'm always going to have to ping it or go to the address, and that as a linux user I ultimately failed at the command line today.

I did learn something though, i thought my dns server address would have been the same as my gateway from reading your settings above buy luckily on the wired setting page before selecting 'options' they were displayed right there on the screen for me so i just copied and pasted them (there were two) and now it seems to be working fine :D

Well it isn't broke any more so I can finally stop fixing it. Thanks very much for the help :)
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Re: [SOLVED] Auto-Up Virtualhosts?

Postby Gord on Fri Nov 30, 2012 6:11 pm

Hey, you're welcome! Glad to hear you got it working.

True, ifconfig only shows the primary IP address for eth0, but

Code: Select all
ip addr show eth0

shows both of them.

Cheers!
Gord
Level 1
Level 1
 
Posts: 46
Joined: Fri Nov 23, 2012 5:14 pm
Location: Canada

Re: Auto-Up Virtualhosts?

Postby derrend on Fri Nov 30, 2012 6:46 pm

Gord wrote:I'm very new to this Mint business


Well your learning pace is phenomenal. Quite right regarding the ip output, so this is what satisfaction feels like 8)

Thanks again :)
derrend
Level 1
Level 1
 
Posts: 29
Joined: Fri Apr 06, 2012 6:13 am

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot], centeronlm, Google [Bot], Google Adsense [Bot], John Wesley, Reorx, tellymandeus and 23 guests