142e8 Multiple jails on host... How they can access each other. - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old August 14th, 2009, 03:36
torr_from_fallout2 torr_from_fallout2 is offline
Junior Member
 
Join Date: Aug 2009
Location: London, Ontario, Canada
Posts: 36
Thanks: 5
Thanked 14 Times in 7 Posts
Talking Multiple jails on host... How they can access each other.

Hi everyone! I'm new here so go easy on me will yea

I've been using ezjail's and so far everything's worked successfully. I've created the following jails with the following programs inside 'em:

10.0.0.1 - SSH
10.0.0.2 - mysql
10.0.0.3 - lighttpd
10.0.0.4 - php
10.0.0.5 - archives (all web sites will go here)

(It's important to note each jail can access the internet)
And now my question is how do I make some of the jails communicate with each other? Here is what I wanted:

lighttpd -> access -> php
lighttpd -> access -> archives (load websites)
lighttpd -> access -> mysql
etc
etc

I can't seem to find any tutorials that would help; moreover, I tried editing the /usr/local/etc/lighttpd.conf file under fastcgi module and I changed so it looks like:
Code:
fastcgi.server = ( ".php" =>
      ( "10.0.0.4" =>
         ( "socket" => "/var/run/lighttpd/php-fastcgi.socket",
           "bin-path" => "/usr/local/bin/php-cgi-cgi"
      )
)
Unfortunately it didn't work, the lighttpd.error.log basically told me that it didn' work lol. Sorry but I'm kinda' at my wits end, could someone help me? Thanks so much!!

Last edited by DutchDaemon; August 14th, 2009 at 11:17. Reason: tag fix
Reply With Quote
  #2  
Old August 14th, 2009, 04:37
anomie's Avatar
anomie anomie is offline
Member
 
Join Date: Nov 2008
Location: Texas
Posts: 783
Thanks: 49
Thanked 113 Times in 100 Posts
Default

Please post the output of # ifconfig from the host environment.
__________________
"Do Not Engage in Useless Activity" --Miyamoto Musashi
Reply With Quote
  #3  
Old August 14th, 2009, 06:26
SirDice's Avatar
SirDice SirDice is online now
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,715
Thanks: 47
Thanked 2,022 Times in 1,861 Posts
Default

Install php in the jail that has lighttpd. It's rather pointless splitting these 2 up.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
  #4  
Old August 14th, 2009, 10:30
ironmikie ironmikie is offline
Junior Member
 
Join Date: Nov 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you want one jail to see a filesystem on another jail you could use mount_nullfs(8). At least that's what i'm doing.

Please reply if this might work for so i can give you the details howto mount_nullfs.

Last edited by DutchDaemon; August 14th, 2009 at 11:19. Reason: [man] tag
Reply With Quote
  #5  
Old August 14th, 2009, 16:10
torr_from_fallout2 torr_from_fallout2 is offline
Junior Member
 
Join Date: Aug 2009
Location: London, Ontario, Canada
Posts: 36
Thanks: 5
Thanked 14 Times in 7 Posts
Default

Hi everyone and thanks for the help!

Believe it or not, I managed to figure out almost everything, first:

I went into the phpjail and ran a code to load the a PHP-CGI server to host access to php through ip using this code:
Code:
php-cgi -b 10.0.0.4:521
So this line(written into the command prompt) made the phpserver bind to the current ipaddress of the jail and started it up.

Then I went inside the wwwjail and I went to the /usr/local/etc/lighttpd.conf file and I went down to the module and I changed it to look like this:
Code:
fastcgi.server = ( ".php" =>
      ( "localhost" =>
         ( 
           "host" => "10.0.0.4",
           "port" => "521"

           #"socket" => "/var/run/lighttpd/php-fastcgi.socket",
           #"bin-path" => "/usr/local/bin/php-cgi-cgi"
      )
)
Basically making lighttpd access the php from off this jail to another jail! Now if I wanted to access mysql, there's already a mysql server running from a different jail, so I'd just have to access it through IP's somehow (haven't done it yet).

Lastley, lighttpd gave an error about not liking the jail, so went to the very bottom of the /usr/local/etc/lighttpd.conf fileand I commented out the IP4 & IP6 part:
Code:
# Enable IPV6 and IPV4 together
#server.use-ipv6 = "enable"
#$SERVER["socket"] == "0.0.0.0:80" {}
__________________________________________________ _

So I guess I solved partially the the problem. My last question is how to make lighttpd access another jail with all the websites? ... would I have to use a ftp file server or something?

Thanks all!
(No need to show ifconfig, everythings working perfectly for the internet: I basically assigned every ip address from the firewall to the jail. So when I plan to get the web-server online, I'll make the firewall point and only point to the lighttpd jail ip �e)
Reply With Quote
  #6  
Old August 14th, 2009, 18:59
Voltar Voltar is offline
Member
 
Join Date: Dec 2008
Location: Bakersfield, California, US
Posts: 191
Thanks: 9
Thanked 23 Times in 17 Posts
Default

Quote:
Originally Posted by torr_from_fallout2 View Post
So I guess I solved partially the the problem. My last question is how to make lighttpd access another jail with all the websites? ... would I have to use a ftp file server or something?
mount_nullfs(8) as already stated, is probably your best bet. Other than that, you probably could use NFS, it may not be optimal though.
Reply With Quote
  #7  
Old August 15th, 2009, 19:49
torr_from_fallout2 torr_from_fallout2 is offline
Junior Member
 
Join Date: Aug 2009
Location: London, Ontario, Canada
Posts: 36
Thanks: 5
Thanked 14 Times in 7 Posts
Default

Hi Voltar!

Could you please give me an example with how to link the two directories using 'mount nullfs'.

Thanks!
Reply With Quote
  #8  
Old August 15th, 2009, 19:54
Voltar Voltar is offline
Member
 
Join Date: Dec 2008
Location: Bakersfield, California, US
Posts: 191
Thanks: 9
Thanked 23 Times in 17 Posts
Default

Quote:
Originally Posted by torr_from_fallout2 View Post
Hi Voltar!

Could you please give me an example with how to link the two directories using 'mount nullfs'.

Thanks!
On the host...

# mount_nullfs /path/to/something /path/to/jail/something


For example if you wanted to mount the ports tree of the host in a jail,

# mount_nullfs /usr/ports /path/to/jail/usr/ports


You can also mount in read only mode with # mount_nullfs -o ro which may be useful in your case if you only want your webserver to be able to read, but not write to the filesystem.
Reply With Quote
  #9  
Old August 15th, 2009, 23:15
torr_from_fallout2 torr_from_fallout2 is offline
Junior Member
 
Join Date: Aug 2009
Location: London, Ontario, Canada
Posts: 36
Thanks: 5
Thanked 14 Times in 7 Posts
Default

Excellent! It all works perfectly!

I've managed to put ssh/lighttpd/mysql/website into different jails and it all works The problem has been solved.

Thanks again Voltar, that did the trick nicely heh heh heeee. Last question if I may though. How do I unmount a 'mount_nullfs' ? Or how do I sever their link or stop it. Lets say I made two folders and now I want to delete them both, how do I do that? (thanks again!)
Reply With Quote
  #10  
Old August 17th, 2009, 09:47
ironmikie ironmikie is offline
Junior Member
 
Join Date: Nov 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can unmount a nullfs mount like every other mount. Just unmount the destination dir.

Last edited by DutchDaemon; August 17th, 2009 at 13:15. Reason: 'You' has not been not spelled 'u' since Prince went out of style
Reply With Quote
  #11  
Old August 24th, 2009, 23:10
z3R0's Avatar
z3R0 z3R0 is offline
Junior Member
 
Join Date: May 2009
Location: /usr/local
Posts: 43
Thanks: 2
Thanked 0 Times in 0 Posts
Default

I wonder if there is an equivalent in Jails to Solaris Zone Doors?
Reply With Quote
Reply

Tags
jail, jails, lighttpd, mount_nullfs, multi jails, mysql, nullfs

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple jails on host... How to get each host network usage gigikent2000 Networking 7 August 14th, 2009 12:44
One host, multiple sites. Help with SSL please! gnr Web & Network Services 21 June 2nd, 2009 08:58
How to know if your jails are out of sync with the host system ironmikie Installing & Upgrading 3 May 12th, 2009 14:47
Anyone using Mandatory Access Controls for Jails running services osx-addict General 4 April 4th, 2009 02:29
Internet access from jails rinalds Networking 5 March 18th, 2009 13:48


All times are GMT +1. The time now is 10:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0