var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
FreeBSD 2 nic one to route one to DB - how do I?
I have a lovely server whit two nics. I want to "abuse" them both
The first nic should handle the normal www traffic (The outsite card)
The second nic should route to the DB server.
My OS is FreeBSD 6.1-RELEASE
www= Apache 2.2
The DB is Mysql 5.x
My IP-Addresses is 22.214.171.124/24 and the IP to the first nic is 126.96.36.199
How do I set this up to force the second nic only to get to the DB server (Only one nic installed)
Other hardware to use for networking build is two swicthes One fare better than the second, therefore I'll prefere to only use that one. One Cisco router.
I have been reading a lot on this site http://www.freebsd.org/doc/en_US.ISO...k-routing.html but i didn't understand it :/ mayby I have been reading to little.
Please give me the exact scipting lines and setup (For dummies)
What is the IP address of the database? Is it directly connected?
route add -host [ip of database] -interface [device name of second interface]
Or, if not directly connected (seems unlikely):
route add -host [ip of database] [gateway on second interface]
the ip address of the DB should be something like 192.168.x.x
I'll guess the the ip-address on the second nic should also be something like 192.168.x.x.. right? but how do I make it so the db can contact the wan... for updates ex.
and i did read the man page whitout getting any wiser
is this the right way to add it onto the /etc/re.conf:
route add -host 192.168.1.2 -interface em1
or should i add "'s around like this
route add "-host 192.168.1.2 -interface em1"
Thanks in advance
well know I can ping the db server, but my website can get data out of there
it tells me this
There seems to have been a problem with the database.
Please try again by clicking the Refresh button in your web browser.
from ssh i can ping from www server to db server whitout any troubles and visa-versa
What did you type to get to where you're at now?
If you can ping the database, then the problem is with your application. Your application needs to be configured to connect to the 192.168.x.x address.
I'm guessing you're using PHP and MySQL. Try the following:
$dbc = mysql_connect("192.168.1.2", "username", "password");
$db = mysql_select_db("database", $dbc);
$query = "SELECT * FROM database.table LIMIT 1");
$result = mysql_query($query, $dbc);
$data = mysql_fetch_array($result);
Here is the response
Warning: mysql_connect() [ function.mysql-connect]: Lost connection to MySQL server during query in /usr/local/www/gndindex.com/test.php on line 2
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/gndindex.com/test.php on line 3
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/gndindex.com/test.php on line 5
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/local/www/gndindex.com/test.php on line 6
I don't know how to translate it
From the web server via SSH, can you issue the following commands successfully?
mysql -u [user] -p -h 192.168.1.2 [database]
[ enter password ]
hmm I don't have a mysql executeble :/ iven when i have mysql client 5.1 installed
is this normal? Do I really have to install the full KySql DB to have an mysql (exe)?