Last active
August 29, 2015 14:25
-
-
Save viglesiasce/0a3d7ea60ff4315354f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -xe | |
| # | |
| # configure vlan for SANs | |
| # | |
| IP=`ifconfig em1 | grep "inet " | awk '{ print $2 }' | awk '{sub("addr:","")}1'` | |
| Octet3=`echo $IP | cut -d"." -f3` | |
| Octet4=`echo $IP | cut -d"." -f4` | |
| NewOctet3=$((Octet3)) | |
| # Registration network | |
| IPADDR="172.16.40."$Octet4 | |
| if_640=/etc/sysconfig/network-scripts/ifcfg-em1.640 | |
| if [ ! -f "$if_640" ] | |
| then | |
| cat > $if_640 <<EOM | |
| DEVICE="em1.640" | |
| ONBOOT="yes" | |
| TYPE="Ethernet" | |
| BOOTPROTO="none" | |
| NETMASK="255.255.255.0" | |
| IPADDR=$IPADDR | |
| USERCTL="no" | |
| VLAN="yes" | |
| NOZEROCONF="yes" | |
| EOM | |
| fi | |
| # VM Private network | |
| IPADDR="172.16.41."$Octet4 | |
| if_641=/etc/sysconfig/network-scripts/ifcfg-em1.641 | |
| if [ ! -f "$if_641" ] | |
| then | |
| cat > $if_641 <<EOM | |
| DEVICE="em1.641" | |
| ONBOOT="yes" | |
| TYPE="Ethernet" | |
| BOOTPROTO="none" | |
| NETMASK="255.255.255.0" | |
| IPADDR=$IPADDR | |
| USERCTL="no" | |
| VLAN="yes" | |
| NOZEROCONF="yes" | |
| EOM | |
| fi | |
| service network restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment