# PS1 Environment Variable for a great case study behind this script
# addendum.]
-export PS1="[\u@\h \w]\\$ "
+export PS1="\033[0m[\033[1;33m\u\033[1;37m@\033[1;32m\]\h \033[1;31m\w\033[0m]\\$ "
+#export PS1="[\u@\h \w]\\$ "
#export PS1='\u@\h:\w\$ '
# End /etc/bashrc
exit 2
fi
fi
- /sbin/iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
- /sbin/iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
+ if [ "$NAME" == "red" ]; then
+ /sbin/iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
+ /sbin/iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${1} -j ACCEPT
+ fi
+
DHCP_START="-N -R -L /var/ipfire/dhcpc "
+
if [ -n "${DHCP_HOSTNAME}" ]; then
- DHCP_START+="-h ${DHCP_HOSTNAME}"
+ DHCP_START+="-h ${DHCP_HOSTNAME} "
fi
/sbin/dhcpcd $1 $DHCP_START >/dev/null 2>&1
# Save the return value
(
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
- # Loading the module if not already done...
- if [ "$name" == "green" ]; then
- modprobe ${GREEN_DRIVER} ${GREEN_DRIVER_OPTIONS} > /dev/null 2>&1
- DEVICE="${GREEN_DEV}"
- elif [ "$name" == "blue" ]; then
- modprobe ${BLUE_DRIVER} ${BLUE_DRIVER_OPTIONS} > /dev/null 2>&1
- DEVICE="${BLUE_DEV}"
- elif [ "$name" == "orange" ]; then
- modprobe ${ORANGE_DRIVER} ${ORANGE_DRIVER_OPTIONS} > /dev/null 2>&1
- DEVICE="${ORANGE_DEV}"
- elif [ "$name" == "red" ]; then
- DEVICE="${RED_DEV}"
- fi
-
- # Check if interface is there...
+ # Check if an interface is there...
if ip link show ${DEVICE} > /dev/null 2>&1; then
link_status=`ip link show ${DEVICE} 2> /dev/null`
if [ -n "${link_status}" ]; then
# Passing the variables to the script
if [ "$name" == "green" ]; then
- NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK}\
+ NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \
NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \
/etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up
elif [ "$name" == "blue" ]; then
- NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK}\
+ NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \
NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \
/etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up
elif [ "$name" == "orange" ]; then
- NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK}\
+ NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \
NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \
/etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up
elif [ "$name" == "red" ]; then
if [ "${RED_TYPE}" == "PPPOE" ]; then
- echo
+ NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up
elif [ "${RED_TYPE}" == "PPTP" ]; then
echo
elif [ "${RED_TYPE}" == "DHCP" ]; then
NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \
PRINTIP=yes PRINTALL=yes \
- /etc/rc.d/init.d/net/red/dhcpcd ${RED_DEV} up
+ /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up
elif [ "${RED_TYPE}" == "STATIC" ]; then
- NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK}\
+ NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \
NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY}
- /etc/rc.d/init.d/net/red/ipv4-static ${RED_DEV} up
+ /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up
fi
fi
)
--- /dev/null
+#!/bin/bash
+########################################################################
+# Begin $network_devices/services/pppoe
+#
+# Description : PPPoE Script
+#
+# Authors : Michael Tremer - mitch@ipfire.org
+#
+# Version : 01.00
+#
+# Notes :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
+
+case "${2}" in
+ up)
+ boot_mesg "Bringing up the PPPoE interface on ${1}..."
+ ip addr add 1.1.1.1/24 broadcast 1.1.1.255 dev ${1}
+
+ if [ "${METHOD}" != "PPPOE_PLUGIN" ]; then
+ PPPCOMMAND="/usr/sbin/pppd pty"
+ PPPOECOMMAND="/usr/sbin/pppoe -p /var/run/pppoe.pid -I ${1} -T 80 -U -m 1412"
+ if [ -n ${SERVICENAME} ]; then
+ PPPOECOMMAND+=" -S ${SERVICENAME}"
+ fi
+ if [ -n ${CONCENTRATORNAME} ]; then
+ PPPOECOMMAND+=" -C ${CONCENTRATORNAME}"
+ fi
+
+ if [ "${DNS}" == "Automatic" ]; then
+ ARGS+=" usepeerdns"
+ fi
+
+ if [ "${AUTH}" == "pap" ]; then
+ ARGS+=" -chap"
+ elif [ "${AUTH}" == "chap" ]; then
+ ARGS+=" -pap"
+ fi
+
+ if [ "${RECONNECTION}" != "persistent" ]; then
+ if [ "${TIMEOUT}" != "0" ]; then
+ SECONDS=$[${TIMEOUT} * 60]
+ ARGS+=" idle ${SECONDS}"
+ fi
+ if [ "${RECONNECTION}" == "dialondemand" ]; then
+ touch /var/ipfire/red/dial-on-demand
+ ARGS+=" demand nopersist connect /bin/true"
+ fi
+ ARGS+=" active-filter outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0"
+ fi
+
+ ARGS+=" noipdefault default-asyncmap defaultroute hide-password local mtu 1492"
+ ARGS+=" mru 1492 noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp"
+ ARGS+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3 lcp-max-configure 50"
+ ARGS+=" maxfail ${MAXRETRIES}"
+
+ if [ "${DEBUG}" == "on" ]; then
+ ARGS+=" debug"
+ fi
+
+ $PPPCOMMAND "${PPPOECOMMAND}" $ARGS
+ evaluate_retval
+
+ else
+ modprobe pppoe
+ PPPCOMMAND="/usr/sbin/pppd plugin rp-pppoe.so ${1}"
+ if [ "${DNS}" == "Automatic" ]; then
+ PPPCOMMAND+=" usepeerdns"
+ fi
+
+ if [ "${AUTH}" == "pap" ]; then
+ PPPCOMMAND+=" -chap"
+ elif [ "${AUTH}" == "chap" ]; then
+ PPPCOMMAND+=" -pap"
+ fi
+
+ if [ "${RECONNECTION}" != "persistent" ]; then
+ if [ "${TIMEOUT}" != "0" ]; then
+ SECONDS=$[${TIMEOUT} * 60]
+ PPPCOMMAND+=" idle ${SECONDS}"
+ fi
+ if [ "${RECONNECTION}" == "dialondemand" ]; then
+ touch /var/ipfire/red/dial-on-demand
+ PPPCOMMAND+=" demand nopersist"
+ fi
+ PPPCOMMAND+=" active-filter outbound and not icmp[0] == 3 & not tcp[13] & 4 != 0"
+ fi
+
+ PPPCOMMAND+=" noipdefault defaultroute hide-password ipcp-accept-local"
+ PPPCOMMAND+=" ipcp-accept-remote passive noccp nopcomp novjccomp"
+ PPPCOMMAND+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3"
+ PPPCOMMAND+=" lcp-max-configure 50 maxfail ${MAXRETRIES}"
+
+ if [ "${DEBUG}" == "on" ]; then
+ PPPCOMMAND+=" debug"
+ fi
+
+ $PPPCOMMAND
+ evaluate_retval
+ fi
+
+ ;;
+
+ down)
+ boot_mesg "Bringing down the PPPoE interface on ${1}..."
+
+ modprobe -r pppoe >/dev/null 2>&1
+ killall pppd
+ sleep 2
+ ip addr del 1.1.1.1/24 broadcast 1.1.1.255 dev ${1}
+
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} [interface] {up|down}"
+ exit 1
+ ;;
+esac
+
+# End $network_devices/services/pppoe