?
Solved

untar file in freebsd

Posted on 2004-11-15
14
Medium Priority
?
3,352 Views
Last Modified: 2013-11-22
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
0
Comment
Question by:dano992
  • 7
  • 6
14 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 12591628
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
 

Author Comment

by:dano992
ID: 12594884
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
 
LVL 1

Expert Comment

by:_Birkoff_
ID: 12595096
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dano992
ID: 12595456
if i send you the instructions he sent to me could you shed a little light on them for me
0
 

Author Comment

by:dano992
ID: 12595580
Cristian are you from Brasil?
0
 
LVL 1

Expert Comment

by:_Birkoff_
ID: 12595653
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
 

Author Comment

by:dano992
ID: 12595801
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
 
LVL 1

Accepted Solution

by:
_Birkoff_ earned 2000 total points
ID: 12596130
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
 

Author Comment

by:dano992
ID: 12597133
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
 
LVL 1

Expert Comment

by:_Birkoff_
ID: 12597713
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
 

Author Comment

by:dano992
ID: 12600401
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
 
LVL 1

Expert Comment

by:_Birkoff_
ID: 12601898
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
 
LVL 1

Expert Comment

by:_Birkoff_
ID: 12601926
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
 

Author Comment

by:dano992
ID: 12604598
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question