วันอังคารที่ 25 พฤษภาคม พ.ศ. 2553

Mysql Updat

UPDATE table_name SET column_name = new_value WHERE column_name = some_value

วันพฤหัสบดีที่ 13 พฤษภาคม พ.ศ. 2553

Bind DNS and internal/external networks: how to serve different data


Bind DNS and internal/external networks: how to serve different data


For example, I want www.foo.com to respond on IP

  • 192.168.1.20 from inside the company’s network
  • 193.134.215.34 from the outside world
In fact, it turns out that it’s quite easy to implement with the Bind DNS server. A friend pointed me to the usage of “ACLs” and “views” in the Bind configuration. Here is a stripped-out basic example for a named.conf acting like we want:

===================================================
//We define an ACL for the LAN
acl "lan" { localhost; 192.168.1.0/24; };
//We define a view for requests from the LAN
view "internal" {
  match-clients { lan; };
  zone "foo.com" IN {
    type master;
    allow-query { any; };
    file "foo.com.internal.hosts";
  };
};
//We define a view for external requests
view "external" {
   match-clients { any; };
   zone "foo.com" IN {
     type master;
     allow-query { any; };
     file "foo.com.hosts";
   };
   zone "bar.com" IN {
     type master;
     allow-query { any; };
     file "bar.com.hosts";
   };
};


==========================================