15:18 14/11/2007

Bridging network interfaces the Red-Hat way

I have been using Linux network bridges for a while at work for various reasons, ranging from installing a new invisible firewall to measuring bandwidth in a client server setup. Until now, I always used a script called by rc.local to create the bridge and add interfaces to it, but today I found the proper Red-Hat way of using bridged interfaces:

If you have read until here, you are probably already aware that, in Red Hat or CentOS, interfaces are configured in /etc/sysconfig/network-scripts/ifcfg-[interface-name]

So the first step is to create a interface file for the future bridge: ifcfg-br0

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.10
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=no
ONBOOT=yes

That file /etc/sysconfig/network-scripts/ifcfg-br0 will create the bridge itself but no interface will be member of that bridge.To add, say, 2 interfaces eth0 and eth1 to the bridge br0, edit or create /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BRIDGE=br0
ONBOOT=yes

and /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BRIDGE=br0
ONBOOT=yes

a reboot or "service network restart" will then create and activate your new Linux network bridge.

You can now easily filter traffic thanks to the physdev module of iptables or install an invisible proxy server.

10:35 14/12/2006

Drupal - Personnaliser le bloc de recherche

le code suivant :
- désactive le bouton "Submit" du bloc de recherche. La recherche est donc tout simplement validee par la touche entree.
- applique la valeur "rechercher ..." au champ de recherche afin d'indiquer un peu a quoi sert ce formulaire.
- remet cet valeur a zero lorsque le champ est selectionné.

Cela donne le "plus-simple-tu-meurs" bloc de recherche en haut a droit de cette page.

code : template.php

function template_search_block_form($form) {
$form['search_block_form_keys']['#attributes'] = 
 array(
  'onselect' => value='\'\'',
  'onclick' => value='\'\''
 );
$form['search_block_form_keys']['#value'] = 
   'rechercher ...';
$form['submit']['#type'] = 'hidden';
$output = form_render($form);
return $output;
}

Syndicate content