Netsetup

From OLPC
Revision as of 08:11, 20 November 2008 by Tony37 (talk | contribs) (New page: The netsetup script completes the schoolserver network configuration. ==Netsetup== #!/bin/bash #usage: ./netsetup school 192.168.5.44 192.168.5.1 255.255.255.0 #where school is the name of...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The netsetup script completes the schoolserver network configuration.

Netsetup

  1. !/bin/bash
  2. usage: ./netsetup school 192.168.5.44 192.168.5.1 255.255.255.0
  3. where school is the name of the school, e.g. Kavre (use one, preferably short word for the schoolname)
  4. where the second parameter is the IP address of the server: 192.168.5.44
  5. where the third parameter is optional when the nameserver is the server IP address with the last field = 1 (i.e. 192.168.5.1)
  6. otherwise, enter the nameserver IP address (e.g. 192.168.5.xxx)
  7. where the fourth parameter is optional (default: 255.255.255.0). Enter it if it is different

set -x set -o nounset set -o errexit echo "install.sh version 2.0" > /tmp/summary.log

  1. complete install and configuration of XS
  2. get command line arguments school, server

USAGE="usage: ./XSinstall school server" set +o errexit if [ -z $1 ]; then echo $USAGE; exit 1;fi if [ -z $2 ]; then echo $USAGE; exit 1;fi if [ -n $1 ]

 then SCHOOL=$1
 else echo $USAGE; exit 1 

fi if [ -n $2 ]

 then SERVER=$2
 else echo $USAGE; exit 1

fi

  1. this needs to be fixed so that default is $SERVER substituting '1' for the last field

if [ -n $3 ]

 then NAMESERVER=$3
 else NAMESERVER= "192.168.5.1"

fi if [ -n $4 ]

 then NETMASK=$4
 else NETMASK= "255.255.255.0"

set -o errexit echo "school is $SCHOOL" >> /tmp/summary.log echo "server is $SERVER" >> /tmp/summary.log echo "WAN nameserver is $NAMESERVER >> /tmp/summary.log echo "WAN net mask is $NETMASK >> /tmp/summary.log echo "execute olpc domain_config script" >> /tmp/summary.log /etc/sysconfig/olpc-scripts/domain_config $SCHOOL.schoolnet.gov.np echo "Edit /etc/hosts" >> /tmp/summary.log

  1. edit /etc/hosts

LINE1=" $SERVER schoolserver1.$SCHOOL.schoolnet.gov.np" sed "s/conference.schoolserver/conference.schoolserver\n$LINE1\n/g" /etc/hosts > /tmp/hosts cp /tmp/hosts /etc/hosts

  1. confirm that /etc/sysconfig/network contains the lines:

sed "s/IPV6_AUTOCONF.*$/IPV6_AUTOCONF=no\nHOSTNAME=schoolserver1.$SCHOOL.schoolnet.gov.np/g" /tmp/network > /tmp/work cp /tmp/work /etc/sysconfig/network echo "/etc/sysconfig/network" >> /tmp/summary.log cat /etc/sysconfig/network >> /tmp/summary.log echo "fix resolv.conf" >> /tmp/summary.log sed "s/nameserver.*$/nameserver 172.18.0.1\nnameserver $SERVER/g" /etc/resolv.conf > /tmp/work cp /tmp/work /etc/resolv.conf service network restart

sed "s/BROADCAST.*$/BROADCAST=172.18.1.255\nGATEWAY=$SERVER/g" /tmp/eth1 /tmp/work cp /tmp/work /tmp/eth1