qwell: branch asterisknow r2019 - /branches/asterisknow/scripts/networking.sh
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Wed Dec 19 17:52:40 CST 2007
Author: qwell
Date: Wed Dec 19 17:52:39 2007
New Revision: 2019
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=2019
Log:
remove a whole bunch of cruft
Modified:
branches/asterisknow/scripts/networking.sh
Modified: branches/asterisknow/scripts/networking.sh
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/scripts/networking.sh?view=diff&rev=2019&r1=2018&r2=2019
==============================================================================
--- branches/asterisknow/scripts/networking.sh (original)
+++ branches/asterisknow/scripts/networking.sh Wed Dec 19 17:52:39 2007
@@ -8,96 +8,25 @@
WAN_INTERFACE="eth0"
LAN_INTERFACE="eth1"
-DNS_CONFIG="/etc/config/resolv.conf"
DHCPD_CONFIG="/etc/udhcpd.conf"
DHCPD_BIN="`which udhcpd`"
DHCPD_PROCNAME="udhcpd"
-INETD_CONFIG="/etc/inetd.conf"
-INETD_BIN="`which inetd`"
-INETD_PROCNAME="inetd"
-INETD_LINE_SSH="ssh stream tcp nowait root /bin/dropbear -i 2 > /dev/null"
NTP_CONFIG="/etc/config/ntp.conf"
ARG_FILE="/etc/asterisk/scripts/network.params"
-# We are going to set default values for the appliance
+# We are going to set default values
if [ -f ${ARG_FILE} ]; then
echo "Configuring with network.params"
. ${ARG_FILE} # Include the file that has the variables in it, written from the GUI.
else
echo "Configuring interface for the first time, or after configuration loss."
- HOSTNAME=sx00i
- IP_LAN=192.168.69.1
- SSHACCESS=no
- DHCP_WAN=on
- DHCP_LAN=on
DHCP_WAN_PROVISION=off
- SUBNET_LAN=255.255.255.0
- START_RANGE_LAN=192.168.69.51
- END_RANGE_LAN=192.168.69.150
- MAX_LEASE=100
- DNS_LAN=${IP_LAN}
- GUI_WAN=off
- TFTP_LAN=http://${IP_LAN}/phoneprov
+ TFTP_LAN=http://0.0.0.0/phoneprov
fi
-
-ifconfig lo 127.0.0.1
# Now for the real logic in the script.
# Note: You CANNOT use functions with msh/busybox.
-
-# Set our hostname
-if [ "${HOSTNAME}" = "" ]; then
- HOSTNAME=asteriskpbx
-fi
-hostname ${HOSTNAME}
-
-# Handle inetd services.
-rm -f ${INETD_CONFIG} ${INETD_CONFIG}.*
-
-# Turn on our ssh server
-if [ "${SSHACCESS}" = "yes" ]; then
- echo "${INETD_LINE_SSH}" > ${INETD_CONFIG}.ssh
-fi
-
-cat ${INETD_CONFIG}.* > ${INETD_CONFIG}
-killall -HUP ${INETD_PROCNAME}
-
-# Delete old default gateways in the routing table
-OLDGATEWAY=`route -n | grep "^0.0.0.0" | grep UG | cut -c 17-32`
-if [ "${OLDGATEWAY}" != "" ]; then
- for i in $OLDGATEWAY; do
- route delete default gw $i;
- done
-fi
-# Setup the WAN interface.
-if [ "${DHCP_WAN}" = "on" ]; then
- # If dhcp_wan is set from the gui
- killall -9 dhcpcd 2> /dev/null
- killall -9 dhcpcd.real 2> /dev/null
- dhcpcd -p ${WAN_INTERFACE} &
-else
- echo "WAN interface is ${WAN_INTERFACE} WAN IP is ${IP_WAN} WAN subnet is ${SUBNET_WAN}"
- echo "DNS config file is ${DNS_CONFIG}"
- ifconfig ${WAN_INTERFACE} ${IP_WAN} netmask ${SUBNET_WAN}
- route add default gw ${GATEWAY_WAN} # Add gateway to routing tables
- echo "`cat ${DNS_CONFIG} | grep search`" > ${DNS_CONFIG}.tmp # Save the previous "search" field
- mv ${DNS_CONFIG}.tmp ${DNS_CONFIG}
- echo "nameserver ${DNS_WAN}" >> ${DNS_CONFIG} # Add the IP/hostname of the nameserver
-fi
-
-# Setup the LAN interface(s).
-echo ${IP_LAN} ${HOSTNAME} > /etc/hosts
-ifconfig ${LAN_INTERFACE} ${IP_LAN} netmask ${SUBNET_LAN}
-iptables -F
-dnsmasq &
-
-# if GUI_WAN is off -> block GUI on wan interface
-if [ "${GUI_WAN}" = "off" ]; then
- echo "Blocking GUI and Manager on WAN Interface"
- iptables -A INPUT -i ${WAN_INTERFACE} -p tcp --dport 80 -j REJECT
- iptables -A INPUT -i ${WAN_INTERFACE} -p tcp --dport 5038 -j REJECT
-fi
# Set our time server
killall -9 ntpd 2>/dev/null
@@ -113,14 +42,6 @@
echo "disable auth" >> ${NTP_CONFIG}
#daemon is started as last thing in script
-# XXX This will pretty much only work for a /24 XXX
-NETWORK_LAN=`echo "${IP_LAN}" | cut -d '.' -f 1,2,3`
-iptables -t nat -A POSTROUTING -s ${NETWORK_LAN}.0/${SUBNET_LAN} -d 0.0.0.0/0 -j MASQUERADE
-echo 1 > /proc/sys/net/ipv4/ip_forward
-# Adjust NAT connection tracker table to drop udp after 15 seconds
-echo 15 > /proc/sys/net/ipv4/netfilter/ip_conntrack_udp_timeout
-echo "LAN network is ${NETWORK_LAN}"
-
if [ "${DHCP_WAN_PROVISION}" = "on" ]; then
echo "Setting limited udhcpd on WAN for provisioning"
# Now we will edit /etc/udhcpd.conf
@@ -134,38 +55,10 @@
# Stop and restart our dhcp server.
killall -9 ${DHCPD_PROCNAME} 2> /dev/null
${DHCPD_BIN} > /dev/null 2> /dev/null &
-elif [ "${DHCP_LAN}" != "off" ]; then
- # Now we will edit /etc/udhcpd.conf
- echo "Setting udhcpd on LAN"
- echo "start ${START_RANGE_LAN}" > ${DHCPD_CONFIG}
- echo "end ${END_RANGE_LAN}" >> ${DHCPD_CONFIG}
- echo "interface ${LAN_INTERFACE}" >> ${DHCPD_CONFIG}
- echo "max_leases ${MAX_LEASE}" >> ${DHCPD_CONFIG}
- echo "remaining yes" >> ${DHCPD_CONFIG}
- echo "opt subnet ${SUBNET_LAN}" >> ${DHCPD_CONFIG}
- echo "opt router ${IP_LAN}" >> ${DHCPD_CONFIG}
- if [ "${DNS_LAN}" != "" ]; then
- echo "opt dns ${DNS_LAN}" >> ${DHCPD_CONFIG}
- fi
- if [ "${DOMAIN_LAN}" != "" ]; then
- echo "opt domain ${DOMAIN_LAN}" >> ${DHCPD_CONFIG}
- fi
- if [ "${LEASE_LAN}" != "" ]; then
- echo "opt lease ${LEASE_LAN}" >> ${DHCPD_CONFIG}
- else
- echo "opt lease 8640000" >> ${DHCPD_CONFIG}
- fi
- if [ "${TFTP_LAN}" != "" ]; then
- echo "opt tftp ${TFTP_LAN}" >> ${DHCPD_CONFIG}
- fi
- echo "opt ntpsrv ${IP_LAN}" >> ${DHCPD_CONFIG}
- # Stop and restart our dhcp server.
- killall -9 ${DHCPD_PROCNAME} 2> /dev/null
- ${DHCPD_BIN} > /dev/null 2> /dev/null &
else
echo "There is NO udhcpd"
killall -9 ${DHCPD_PROCNAME} 2> /dev/null
fi
#Finish ntp daemon work.
-ntpd -g &
+ntpd -g &
More information about the asterisk-gui-commits
mailing list