Re: [Q] Virtual hosts and routing...
Since we are trading scripts, here is mine. I'd kinda like it if there
were some functions like this in, or better yet, included from the network
script.
Ciao!
--
"Baldrick, you wouldn't see a subtle plan if it painted itself purple and danced naked on top of a harpsichord, singing 'Subtle Plans Are Here Again.'"
--Edmund Blackadder II
The Doctor What: Un-Humble http://www.gerf.org/~docwhat/
docwhat@gerf.org (finger docwhat@gerf.org for PGP key)
KF6VNC
#!/bin/sh
# Local Network
ifconfig lo 127.0.0.1
route add -net 127.0.0.0
# This sets up the entire interface
# and adds a default route to the ip
ipup() {
echo \* Configuring ${IPADDR} ${IFACE}
ifconfig ${IFACE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
route add -host ${IPADDR} dev ${IFACE}
# The virtual IP docs say to do this, but it just break things as near as
# I can tell
# route add -net ${NETWORK} ${IFACE}
# This makes sure that the router can find us.
[ "${MACADDR}" ] && rarp -s ${IPADDR} ${MACADDR} ; \
arp -s -i ${IFACE} ${IPADDR} ${MACADDR} pub
}
IPADDR=216.178.140.4
IFACE=eth0
NETMASK=255.255.255.0
NETWORK=216.178.140.0
BROADCAST=216.178.140.255
GATEWAY=216.178.140.1
MACADDR=00:10:4B:14:18:B5
ipup
[ "${GATEWAY}" ] && route add ${GATEWAY} ${IFACE}
[ "${GATEWAY}" ] && route add default gw ${GATEWAY} metric 1 ${IFACE}
IPADDR=216.178.140.240
IFACE=eth0:0
ipup
IPADDR=216.178.140.241
IFACE=eth0:1
ipup
IPADDR=216.178.140.242
IFACE=eth0:2
ipup
IPADDR=216.178.140.243
IFACE=eth0:3
ipup
IPADDR=216.178.140.244
IFACE=eth0:4
ipup
IPADDR=216.178.140.245
IFACE=eth0:5
ipup
IPADDR=216.178.140.246
IFACE=eth0:6
ipup
IPADDR=216.178.140.247
IFACE=eth0:7
ipup
IPADDR=216.178.140.248
IFACE=eth0:8
ipup
IPADDR=216.178.140.249
IFACE=eth0:9
ipup
IPADDR=216.178.140.250
IFACE=eth0:10
ipup
IPADDR=216.178.140.251
IFACE=eth0:11
ipup
IPADDR=216.178.140.252
IFACE=eth0:12
ipup
IPADDR=216.178.140.253
IFACE=eth0:13
ipup
IPADDR=216.178.140.254
IFACE=eth0:14
ipup
# This is broadcast, dummy!
#IPADDR=216.178.140.255
#IFACE=eth0:15
#ipup
exit
Reply to: