untar file in freebsd

here it goes
i have a freebsd server set up as a backup firewall in case the main one fails(firewall02)
the person that set all this up is no longer available he basically bailed out on me bofore he explained the setup to me
he sent me an email that says if the main firewall fails to untar a fille called "fw_cfg.tar"
that is located in the admin account on firewall 2 box

im completely new to freebsd this doesnt really help me out
if anyone out there could give me instructions on hou to untar the file and make this box my firewall i would be verry appreciative
im looking for step by step instructions
if you need more info i will gladely provide
dano992Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yuzhCommented:
To verify what's in the tar file:

tar -tvf fw_cfg.tar

to extract files from the tar ball:
tar -xvf  fw_cfg.tar

If the the files in the tarball use relative path, you need to, cd to the installation dir, then
untar the file, eg:

cd /mydir
tar xvf /path-to/fw_cfg.tar

man tar

to learn more details

PS: to install software, you need to login as root or "su" as root to do the job.
0
dano992Author Commented:
so to untar the file i would " tar -xvf  fw_cfg.tar"
to install the tar file i would change to the root user and execute which command ?
im sorry for lack of understanding but i never worked with BSD before
0
_Birkoff_Commented:
Well... Yes, to untar the file, you just need to type tar -xvf filename.tar
Using that command, you will untar the content of the tar file in the current folder.

Probably that file has the firewall rules... Or maybe it has a bash script to reconfigure your firewall...

I suggest that you should create a new dir ("mkdir new_folder"), enter this folder and than untar the file there. Then take a look in the files, too see what they are, what they do... Just then untar it in an existing folder like you said the previous admin did.

Since you say you  never worked with FreeBSD before, fell free to send me the files you you would like me to take a look and explain what are they and whaat you should do with them... --> cristian(at)floripa(dot)com(dot)br

Cristian
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

dano992Author Commented:
if i send you the instructions he sent to me could you shed a little light on them for me
0
dano992Author Commented:
Cristian are you from Brasil?
0
_Birkoff_Commented:
Yes, sure, I can help you... And Yes, I am from Brasil!

* Você é brasileiro tb??? Pode manda aí os arquivos na boa, dou uma olhada aqui! *

0
dano992Author Commented:
here is what he sent me they were supposed to train me on this but this is all i got
im not brazilllian but i spend 1 month in brasil every year my wife is from Rio

After each configuration change to /etc/rc.conf or /etc/ipf.rules or /etc/hosts

type this:

tar cvf filename.tar /etc/rc.conf /etc/ipf.rules /etc/hosts

and it will create a archive file, like an uncompressed zip file

copy this over to the other box and leave it in /root (root users home dir), copy it to the admin box also.

scp source dest

remote format is user@host:/path/to/file/filename.tar

local format filename.tar or a '.' , it means to put file in this directory.

now each of the firewalls has 2 Ethernet ports check that fxp1 is assigned to the same network on both boxes and the same with fxp0.
fxp0 should be the up(internet facing) and fxp1 should be down( db facing)

after this has been verified you can untar the file made above and if needed get on the switch and turn off the port for the problem firewall.

then reboot the box and it should come up  as the firewall

since i know nothing about bsd i need a little more step by step instructions
i really appreciate you doing this for me if you need anything just let me know
0
_Birkoff_Commented:
Ok, lets take a look on that instructions":

*After each configuration change to /etc/rc.conf or /etc/ipf.rules or /etc/hosts
*type this:
*tar cvf filename.tar /etc/rc.conf /etc/ipf.rules /etc/hosts
*and it will create a archive file, like an uncompressed zip file
*copy this over to the other box and leave it in /root (root users home dir), copy it to the admin box also.
*scp source dest
*remote format is user@host:/path/to/file/filename.tar
*local format filename.tar or a '.' , it means to put file in this directory.

Well, that all is a detailed instruction of "how to backup you firewall configuration files". With that information, and the instruction that he gave to you ("he sent me an email that says if the main firewall fails to untar a fille called "fw_cfg.tar""), it looks like fw_cfg.tar should have the 3 firewall configuration files (/etc/rc.conf /etc/ipf.rules /etc/hosts).
You may check it using the command "tar -tvf fw_cfg.tar". It will show what is inside the tar archive. If they are only these 3 files, all ok...

If the 3 files are inside the tar, do that:

 - In any folder you want, use this command: "tar cvf fw_cfg_backup_20041116.tar /etc/rc.conf /etc/ipf.rules /etc/hosts". This will backup your conf files... Not realy necessary, but I suggest you never change anthing withou baking up :-D...
 - Now in another folder, create a temp dir called, for example, temp_firewall_cfg ("mkdir temp_firewall_cf"). You could unar directly in the /etc folder, but again, just to avoid overwriting another thing, i suggest you untar it in this folder)
 - Enter this folder, and unpack the tar file: "tar -xvf  /folder/of/fw_cfg.tar"
 - Move the files rc.conf, ipf.rules and hosts to /etc ("mv rc.conf /etc/", "mv ipf.rules /etc/", "mv hosts /etc/")
 - Reboot the computer... ("reboot")

Well... That is what i understood of the instructions that you send me, if is just that that the other admin told you to do, than that shoud solve your problem...

*now each of the firewalls has 2 Ethernet ports check that fxp1 is assigned to the same network on both boxes and the same with fxp0.
*fxp0 should be the up(internet facing) and fxp1 should be down( db facing)
*after this has been verified you can untar the file made above and if needed get on the switch and turn off the port for the problem firewall.
*then reboot the box and it should come up  as the firewall

That looks like some things specific to the architeture of your network, anyway, this things are definder in rc.conf so if the tar file is cocrrect there is no need to verify that... :-D

If you have any problem, just take the backup conf files (that are in the fw_cfg_backup_20041116.tar) and reboot, all will be like it is now ;-D

I hope I helped you.. any question, feel free to ask...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dano992Author Commented:
this is awsome one more question
when i ran "tar -tvf fw_cfg.tar" it came back with "f1_tar.gz" along with  my other 2 firewall files
so im assuming that the 3 files  (rc.conf, ipf.rules and hosts )are inside this .gz file
whats the syntex to unzip this file

0
_Birkoff_Commented:
Hmmm... yes, this is a Gziped tar file... (Gzip compresses the file)
You should untar the firist file, then enter the folder and run
"tar zxvf f1_tar.gz" (note the "z")
That will ungzip and untar the files...

Cristian
0
dano992Author Commented:
this is awsome i couldnt have done this without you
i just have one more final question
i created a directory :/home/root/NEWDIRECTORY
and untared the file it created an ETC folder inside the newdiectory folder and all 3 files are inside this etc folder
now my question is when i use the Move the files rc.conf, ipf.rules and hosts to /etc ("mv hosts /etc/")
hou does it know which /etc folder to move it to
since i now have a new  etc folder that was created inside my newdirectory folder
im not that familliar with bsd file structure
by the way what part of Brasil are you from
0
_Birkoff_Commented:
Hi!!! I am glad i helped you!
I know how it is to be new in FreeBSD ;-D... 3 years ago I used a FreeBSD for the very firist time (i had experience with linux, that helped a lot, but i was not easy anyway).... The system was very old, and i had a lot of problems to make things work...

Your question is about the system tree in FreeBSD... It works like that:
/ is the root directory, the main one, lets say, is "your C:\"
Another partitions and drivers are not mounted with another driver letter, but in a folder... So your cdrom is usually in the folder /mnt/cdrom, your windows particion (if you have a windows in the same pc) is usually in /mnt/windows..
/etc is the folder where the system put most of the configuration files.
/root is the administrator user folder
/home is the folder where usually the folders of the other users are...

So, that is bassicaly the way that the system tree works...
Use the command "df -h" to see the partitions, where they are mounted and the space availale in each one... An usual FreeBSD installation uses more than 5 partitions...

man intro can guide you in some basics of freeBSD... I would suggest also, if you have time, to take a look here:
http://www.freebsd.org/projects/newbies.html

They are many docs and instructions to "newbies" on FreeBSD ;-D

And, of course, fell free to ask for help any time!

Cristian
0
_Birkoff_Commented:
Duhhh.. i didnt answered the question, but i think you can figure out the answer... anyway, the system knows they are different folder because they are in different locations, one is in /home/root/etc and another is in /etc

Btw, more one tip: To reffer to the current folder, you can sue ./ (notice the "." before the "/").. So to move a file from somewhere to your current folder, you can use:
"mv /somewhere/somefile ./"
To check in wich folder you are, you can use
"pwd"
You can use also ~/ to reffer to the users home folder (in your case, is looks like the root home folder is /home/root)
So ~/etc when you are logged as root would reffer to /home/root
And ~username reffers to the "username" home folder

Cristian

0
dano992Author Commented:
Once again Thanks
im going to try to swich to the failover firewall today
when it all comes down to it all i reallly need is to place those 3 files in the /etc directory
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.