Results 1 to 8 of 8
  1. #1

    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 and the IP to the first nic is

    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 but i didn't understand it :/ mayby I have been reading to little.

    Please give me the exact scipting lines and setup (For dummies)

  2. #2
    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]

  3. #3
    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 -interface em1

    or should i add "'s around like this

    route add "-host -interface em1"

    Thanks in advance

  4. #4
    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

    any suggestions?

  5. #5
    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("", "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);

  6. #6
    Here is the response

    Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /usr/local/www/ on line 2

    Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/ on line 3

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/ on line 5

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/local/www/ on line 6

    I don't know how to translate it

  7. #7
    From the web server via SSH, can you issue the following commands successfully?
    mysql -u [user] -p -h [database]
    [ enter password ]
    show tables;

  8. #8
    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)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts