#!/bin/sh # $Id: network.ini,v 1.9 2005/08/13 10:02:16 thomasez Exp $ # Remember to set up the network interface card with IRQ and base address # in syslinux.cfg if nessesary. # # Grabbing the config. # . /etc/config # # Grabbing the function library. # . /etc/functions.inc ifconfig lo 127.0.0.1 # # Brad wanted these next 5 lines. # cat > /etc/inside.info <<-EOF INSIDE_DEVICE=$INSIDE_DEV INSIDE_IP=$INSIDE_IP INSIDE_NETMASK=$INSIDE_NETMASK EOF # # Let's make things easier for the users and find this automagically. # [ -n "$INSIDE_IP" ] && [ -n "$INSIDE_NETMASK" ] && { eval `ipcalc -n -b $INSIDE_IP $INSIDE_NETMASK` INSIDE_NETWORK=$NETWORK unset NETWORK INSIDE_BROADCAST=$BROADCAST unset BROADCAST } cat >> /etc/inside.info <<-EOF INSIDE_NETWORK=$INSIDE_NETWORK INSIDE_BROADCAST=$INSIDE_BROADCAST EOF # Resetting. NETWORK= BROADCAST= # # Setting up the inside: # configure_interface $INSIDE_DEV $INSIDE_IP \ netmask $INSIDE_NETMASK broadcast $INSIDE_BROADCAST # # setting up /etc/hosts # echo "" echo "$INSIDE_IP $HOSTNAME.$DOMAIN $HOSTNAME" >> /etc/hosts # setting up hostname hostname $HOSTNAME hostname -d $DOMAIN echo "Hostname (fully qualified) set up to `hostname -f`" # # Tip from Jacco Kok. Setting the MAC address to fool # some bootp/dhcp servers and arp. # if [ -n "$OUTSIDE_MAC" ] then echo "Faking MAC address." ifconfig $OUTSIDE_DEV hw ether $OUTSIDE_MAC fi # # DMZ Setup. This has to be done before the OUTSIDE stuff since # it's the outside stuff that starts firewall.ini # if bool_value $USE_DMZ then # # Let's make things easier for the users and find this automagically. # echo "Setting up DMZ network." eval `ipcalc -n -b $DMZ_IP $DMZ_NETMASK` DMZ_NETWORK=$NETWORK DMZ_BROADCAST=$BROADCAST configure_interface $DMZ_DEV $DMZ_IP netmask $DMZ_NETMASK broadcast $DMZ_BROADCAST cat > /etc/dmz.info < /etc/outside.info if /etc/udhcpc.sh then . /etc/outside.info else echo "duh!" # Or some more useful error handling echo -n "Sorry, I could not get an IP address," echo -n " I'd better quit." exit; fi ;; EXTERNAL) echo "Connetion method is an External script (/etc/ext-up.ini)" /etc/ext-up.init ;; *) # STATIC and the rest. echo "Connetion method is the default (STATIC)." # # Let's make things easier for the users and # find this automagically. # eval `ipcalc -n -b $OUTSIDE_IP $OUTSIDE_NETMASK` OUTSIDE_NETWORK=$NETWORK OUTSIDE_BROADCAST=$BROADCAST configure_interface $OUTSIDE_DEV $OUTSIDE_IP \ netmask $OUTSIDE_NETMASK broadcast $OUTSIDE_BROADCAST route add default gw $DEFAULT_GATEWAY metric 1 echo "Setting up name server (etc/resolv.conf) " echo "search $DOMAIN" >> /etc/resolv.conf NAME_SERVER=`echo $OUTSIDE_NAMESERVERS | sed 's/,/ /g'` for i in $NAME_SERVER do echo "nameserver $i" >> /etc/resolv.conf done unset i cat > /etc/outside.info < /dev/null || /sbin/dnsmasq $DNSMASQ_OPTS else if bool_value "$DNSMASQ" then pidof dnsmasq > /dev/null || /sbin/dnsmasq $DNSMASQ_OPTS fi fi if bool_value "$DMZ_DHCP_SERVER" then /etc/dmz-udhcpd.conf.sh /sbin/udhcpd /etc/dmz-udhcpd.conf pidof dnsmasq > /dev/null || /sbin/dnsmasq $DNSMASQ_OPTS fi