How to add/remove/change route

The route command is used to show/manipulate the IP routing table. It is primarily used to setup static routes to specific host or networks via an interface.

Display existing routes

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.2.8.1        0.0.0.0         UG    0      0        0 eth0
10.2.8.0        *               255.255.252.0   U     0      0        0 eth0
10.10.16.0      10.10.32.53     255.255.240.0   UG    0      0        0 tun0

Change default gateway

# route del default
route add default gw 10.2.0.4

Add a route for a given network

route add -net 172.17.255.0/24 gw 195.54.62.1

Remove a route for a given network

route del -net 172.17.255.0/24 gw 195.54.62.1

Reject routing for a given network

route add -net 192.168.1.0/24 reject

[Debian] Installing APC

APC is a PHP accelerator (like eAccelerator or XCache) but dedicated for PHP5. It can reduce PHP script runtime by a factor 5 to 10. Unfortunately it’s not packaged in Debian Etch but you can still install it easily using pear’s repositories.

Install PEAR

aptitude install php-pear
aptitude install php5-dev apache2-prefork-dev build-essential

Install APC module

pecl install apc

PEAR configuration

vi /etc/php5/conf.d/apc.ini
extension=apc.so
apc.enabled=1
apc.shm_size=30

Adapt the values depending your applications requirements. Then restart apache. You can check if apc is correctly loaded by creating a page with a phpinfo(); call.