Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # quicknet
- #
- # quickly set up for networking on specified interface & IP
- #
- # Date Who What/notes
- # ----------- ----------------------- ------------------------------------
- # 26 Feb 2010 Aaron R. Kulkis Original version
- #
- #
- # Essence of program:
- # prompt and read INTERFACE
- # ifup $INTERFACE
- # ifconfig
- # prompt and read IP
- # ifconfig $INTERFACE $IP
- # ifconfig
- # prompt and read ROUTER
- # route add $ROUTER $INTERFACE
- # route
- # route add default gw $ROUTER $INTERFACE
- # route
- # ping ROUTER (confirm connection to router)
- # ping 8.8.8.8 (Google open DNS host, confirms gateway operation))
- # ping www.google.com (confirms DNS operation)
- #
- #
- SELF=`basename $0`
- #
- #### GET INTERFACE ##################
- #
- printf "Use which interface ? "
- read INTERFACE
- printf "execute ifup $INTERFACE ?"
- read RESPONSE
- case RESPONSE in
- y* | Y* )
- set -x
- ifup $INTERFACE
- ifconfig $INTERFACE
- set +x
- ;;
- esac
- #
- #### GET ADDRESS ##################
- #
- printf "What IP address for $INTERFACE ? "
- read IP
- printf "\nAttempting to configure $INTERFACE\n"
- set -x ; ifconfig $INTERFACE $IP ; set +x
- printf "\nPress return key" ; read A
- set -x ; ifconfig $INTERFACE ; set +x
- #
- #### DEFINE ROUTER ##################
- #
- printf "What is the name or IP address of the router/gateway? "
- read ROUTER
- printf "specifying path to router $ROUTER\n"
- set -x ; route add $ROUTER $INTERFACE ; set +x
- printf "\nPress return key" ; read A
- printf "Verifying route added to route table\n"
- set -x ; route ; set +x
- printf "defining $ROUTER as the gateway.\n"
- set -x ; route add default gw $ROUTER $INTERFACE ; set +x
- printf "\nPress return key" ; read A
- printf "Verify route added to route table\n"
- set -x ; route ; set +x
- #
- #### VERIFY ROUTE COMPLETE ##################
- #
- printf "Verifiny that route table complete:\n"
- set -x ; route ; set +x
- printf "test local network with 3 pings: "
- set -x; ping -c 3 $ROUTER ; set +x
- printf "test routing by pinging Google public DNS servers 3 times each\n"
- set -x
- ping -c 3 8.8.8.8
- ping -c 3 8.8.4.4
- set +x
- printf "Testing DNS functionality:\n pinging www.google.com 3 times\n"
- set -x; ping -c 3 www.google.com ; set +x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement