Network Configuration Script
#1
Network Configuration Script
Hey guys,

Worked today on an IRIX configuration script that uses ksh and is usable on a base install. It'll allow you to setup a network moreorless automatically given hostname, resolvers, gateway, etc.

Code:
#!/bin/ksh

# Functions of this script

function sysid {

echo -ne 'I need a hostname: '
read h
printf $h > /etc/sys_id

}

function resolv {

echo -ne 'Give me a primary DNS resolver IP: '
read r1
echo -ne 'Give me a secondary DNS resolver IP: '
read r2

printf "nameserver $r1\nnameserver $r2\n" > /etc/resolv.conf

}

function set_ip {

echo -ne 'Give me your IP address: '
read ip
printf "$ip   $h\n" >> /etc/hosts


printf 'Disabling network services...\n'
chkconfig autoconfig_ipaddress off
chkconfig routed off

echo -ne 'Now I need your default gateway: '
read dg

printf "\$ROUTE \$QUIET add -net default $dg\n" >> /etc/config/static-route.options

}

function zone {

echo -ne 'Finally, lets get your timezone. You need to use the format, EST5EDT4. When ready, enter it: '
read tz

printf "TZ=$tz" > /etc/TIMEZONE

ntpdate us.pool.ntp.org
}

case $1 in

        -hn)
        sysid ;;

    -rs)
        resolv ;;

        -ip)
        set_ip ;;

        -a)
        printf "Performing normal setup...\n"
        sysid
        resolv
        set_ip
        zone ;;

    -nt)
        printf "Networking setup...\n"
        sysid
        resolv
        set_ip
        ;;

        *)
        printf 'netsetup - convenient script for quick IRIX networking setup\n
usage: netsetup <option>\n\n -hn: hostname setup\n\n -rs: DNS resolver\n\n -ip: Configure static IP\n\n -a: normal setup, does all tasks include timezone
\n -nt just networking tasks (no timezone)\n'
        ;;
esac


Suggestions, testing etc. are welcomed. If you use it, I'm not responsible for nuking a functional config.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
02-07-2020, 02:29 AM
#2
RE: Network Configuration Script
If you guys are interested, I'm also doing scripts that will automate securing IRIX (basically doing stuff described here and over here)

Only stipulations for scripts of this type for me to write are:

1. They must avoid bashisms or ANYTHING that isn't included in a base install. These are designed primarily to bootstrap IRIX systems by copying them over telnet, ftp, rcp or another legacy method. That means not requiring a user to install or do anything. They should just be able to chmod +x and run, and end up with a reasonably sane config.

2. Mine will avoid using git/hg even if the proposed extension involves installing that, or downloads over https. Because these services are broken in an IRIX base install; there's literally zero point in doing that. 

3. Must be usable by other people, i.e. not a specialized case. I have my own versions of these that aren't prompting, and that make assumptions for myself. Obviously, you can modify these too.

These are public domain property as far as I'm concerned. Do whatever you want.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
02-07-2020, 06:35 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)