In recent days I was confronted with a problem regarding the routing under Linux.
The request was to add a route on a Proxy ARP server.
The Linux OS does give you the possibility to do add a route, in an “automatic mode”, in ways like:
- add a route on the interface configuration (it will be applied only when the interface will go on-line) – for example Ubuntu and SUSE Linux
- add a route on the network start script
- add a route in the static-routes file
- add a route with a script on the ifup folder on the “/sbin/ifup” (here more details: http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlsysconfig.html)
But because this was a complicated setup I was forced to use a bash script under the “/sbin/ifup”.
The script looked like this:
#!/bin/sh
ROUTE_CMD=”/sbin/route”
DMZ_INTERFACE=”eth0″ #we should have an IP address on this network – 85.14.228.0/24
LAN_INTERFACE_1=”eth1″ #we should have an IP address on this network – 10.12.0.0/24
EXTIPADDR=”85.14.228.254″ #an dmz gateway
INTIPADDR=”10.12.0.254″ #all the internal traffic$ROUTE_CMD add -host 85.14.228.248 gw $EXTIPADDR $DMZ_INTERFACE
$ROUTE_CMD add default gw $INTIPADDR $LAN_INTERFACE_1
exit 0
I hope that this is going to help you,
Mihai out!