-
Notifications
You must be signed in to change notification settings - Fork 3
/
interface_rebuild_splat.sh
29 lines (24 loc) · 1.15 KB
/
interface_rebuild_splat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Written by Craig Dods
# Last Edit on 02/27/2013
# This does not currently function on:
# Firewalls with bridged interfaces (LACP)
# Firewalls with interface numbers above eth9
# Not suggested for usage on VSX.
echo "Hello, please enter the correct log file to analyze"
ls | grep interfaces
read logfile
echo "Thank you - Recreating interfaces now"
# Creating non-VLAN interfaces
cat $logfile | grep -v "eth.\." | sed 's/\:/ /g' | awk '{print "ifconfig",$1" up"}' | sort -u | sh
cat $logfile | grep -v "eth.\." | awk '{print "ifconfig",$1,$2" netmask",$3 }' | sh > /dev/null 2>&1
cat $logfile | grep -v "eth.\." | awk '{print "ifconfig",$1" up"}' | sh
# Creating VLAN'd interfaces
cat $logfile | grep "eth.\." | sed 's/\./ /g' | awk '{print "ifconfig",$1" up"}' | sh
cat $logfile | grep "eth.\." | sed 's/\./ /g' | awk '{print "vconfig add",$1,$2}' | sh
cat $logfile | grep "eth.\." | awk '{print "ifconfig",$1,$2" netmask",$3 }' | sh > /dev/null 2>&1
cat $logfile | grep "eth.\." | awk '{print "ifconfig",$1" up"}' | sh
echo "Finished recreating the interfaces..."
echo " "
echo "Please remember to run ifconfig --save when finished!"
echo "Goodbye "