Solved

FreeBSD Network Configuration help

Posted on 2004-09-23
14
664 Views
Last Modified: 2011-10-03
Hi,
We recently setup a FreeBSD server (latest stable version) on our network to handle our PHP/MySQL sites.  I'm new to FreeBSD, so I'm having trouble assigning an external IP address to the machine.  I know how to do this on a windows environment, but how do I accomplish this same task on FreeBSD.

Things I've tried:
1) from the terminal as the root user....# /stand/sysinstall
- from here I select "configure"
- to "Networking"
- to "xl0" ethernet card device
- "do you want ipv6 to configure"..."No"
- "do you want dhcp to configure"..."No"
- no onto the configuration form screen...
- Host Name = "slinky"
- Domain - ""
- Gateway = 209.161.7.201
- Local Name Serve = 192.168.1.103
- IP (this is the external IP) = 209.161.7.202
- Net Mask = 255.255.255.248
- I click "ok"...(sometimes it will accept these inputs...other times it will complain about an invalid gateway value...)

2) using ifconfig
- from the shell: ifconfig "xl0" 209.161.7.202 gateway 209.161.7.201 netmask 255.255.255.248
- again, sometimes the gateway is accepted...other times it is not
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Ok, so assuming that either of these ways is successful (no gateway problems)...the if i run:
ifconfig

this should return my new address information right?  NO...instead it returns the information that would've been assigned to me had I used dhcp to set up my connection instead.

It seems like my changes just aren't getting set properly or something.  How can I check to make sure things are being set properly?

One other thing...I just noticed that after I let the /stand/sysinstall wizard run, the terminal returns an error "/: failed to write file.  file system is full."  that doesn't sound good...maybe that is the whole problem?...I don't know.

As I am fairly worthless in this new server environment, I'd appreciate a very detailed solution.  Please assume I am completely ignorant to any FreeBSD software programs/commands you may refer to.  My knowledge level is just good enough to barely get the system setup with apache, mysql and php.  I have thus used the ports collection somewhat and I understand how to get to the shell from my Gnome desktop environment.

This is pretty important, so I'm making it worth your while...500 points...even if it turns out to be something easy and stupid to fix (which I'm sure it is).
0
Comment
Question by:shoeman22
  • 8
  • 2
14 Comments
 
LVL 9

Expert Comment

by:fixnix
ID: 12136984
A full disk obviously isn't good.....from a command prompt, issue the command 'df' (you can try 'df -h' but I don't remember if FreeBSD allows the -h switch...I think OpenBSD does not have that switch.  df can stand for 'disk free' and outputs the free space (in blocks, or in "human readable" megabytes if the -h switch is used) for each partition (except swap)).

Start there and let us know your free space situation.

As far as assigning multiple ip's to the same interface, I'll have to google for the syntax since it's been about 4 years since I've set up ip aliases on a FreeBSD box but it's pretty simple to manually set it up.  I assume you'd want the aliases to be active upon a reboot as well, so I'll post again later if I can with specifics.  In the mean time, post the output of 'df -h' (or just df) so we can address the free space issue first.  Without free space you're asking for many problems...although I have a few dust-collecting, power-bill-raising old sparcstations w/ 500ish MB system drives that I'll let fill up just to be mean if I'm in a bad mood ;)
0
 
LVL 9

Expert Comment

by:fixnix
ID: 12137023
To manually bind additional ip's to a nic, use:

ifconfig xl0 inet 209.161.7.203 netmask 255.255.255.248 alias
ifconfig xl0 inet 209.161.7.204 netmask 255.255.255.248 alias
ifconfig xl0 inet 209.161.7.205 netmask 255.255.255.248 alias
ifconfig xl0 inet 209.161.7.206 netmask 255.255.255.248 alias
ifconfig xl0 inet 209.161.7.207 netmask 255.255.255.248 alias
ifconfig xl0 inet 209.161.7.208 netmask 255.255.255.248 alias

as required
0
 

Author Comment

by:shoeman22
ID: 12137036
You know, come to think of it...I doubt the configuration data is ever being written to a file...hence the "file system full...didn't write to file" 'esque message.

My system harddrive is more than large enough to handle just running FreeBSD, hosting websites, and mySQL, but the other day I ran a "ping" command (without specifiying the -c option) and it continued to run for awhile.  It was after that that the "file system full" message started popping up.

So, with that in mind...how can I clean up the file system then?
0
 
LVL 9

Expert Comment

by:fixnix
ID: 12137047
And to have the aliases active at boot time,  add the above ifconfig lines towards the end of the /etc/rc.local file.
0
 
LVL 9

Expert Comment

by:fixnix
ID: 12137069
"So, with that in mind...how can I clean up the file system then?"

Post the output from 'df' or 'df -h' so we can better assess your free space situation.

I suspect you have ample room, but are partitioned less than optimally and are running out of space on whatever partition holds your /var/log
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 9

Expert Comment

by:fixnix
ID: 12137486
In case I get tied up and can't post back for a while, I'll venture into speculationland and give a few concepts on what to do next if you are in fact out of space on, say, the '/' partition:

Basically, if one partition is full and others have lots of room, what you'll want to do is take some of the larger subdirectories that filled up the partition and copy them to another partition then delete the original subdirectory and symlink it to the subdirectory you copied to on the partition with more room.  Example:

[root@www root]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ide/host0/bus0/target0/lun0/part3
                      958M   78M  831M   9% /
/dev/ide/host0/bus0/target0/lun0/part1
                      471M  5.1M  442M   2% /boot
/dev/ide/host0/bus0/target0/lun0/part8
                      1.9G   36M  1.9G   2% /home
/dev/ide/host0/bus0/target0/lun0/part6
                      958M   68K  909M   1% /tmp
/dev/ide/host0/bus0/target0/lun0/part9
                      4.7G  1.6G  2.9G  36% /usr
/dev/ide/host0/bus0/target0/lun0/part5
                      958M  509M  401M  56% /var
/dev/ide/host0/bus0/target0/lun0/part7
                      958M  8.0K  909M   1% /var/tmp
[root@www root]#


So we see that /var is at 56%...let's pretend it was at or near 100% and that made us nervous (rightly so)...

[root@www root]# cd /var
[root@www var]# ls -l
total 68
d-wx-wx-wt    2 apache   apache       4096 Sep 15  2003 apache-mm/
drwxr-xr-x    7 root     root         4096 Dec  4  2003 cache/
drwxrwxr-x   14 root     man          4096 Nov 29  2003 catman/
drwxr-xr-x    2 root     root         4096 Aug  5  1998 db/
drwxr-xr-x    2 root     root         4096 Sep 16  2003 empty/
drwxr-xr-x   18 root     root         4096 Nov 30  2003 lib/
drwxr-xr-x    2 root     root         4096 Feb  6  1996 local/
drwxrwxr-x    3 root     root         4096 Sep 15 04:06 lock/
lrwxrwxrwx   1 root     root           22 Aug 16 16:11 log -> /usr/var-overflow/log//
drwx------     2 root     root         4096 Dec 24  2003 lost+found/
drwxr-xr-x     2 root     root         4096 Sep 23 17:19 mail/
drwxr-xr-x     2 root     root         4096 Feb  6  1996 nis/
drwxr-xr-x     2 root     root         4096 Apr 13  2000 opt/
drwxr-xr-x     2 root     root         4096 Feb  6  1996 preserve/
drwxr-xr-x   10 root     root         4096 Sep 15 06:28 run/
drwxrwxrwt   3 root     root         4096 Sep 15 04:36 tmp/
drwxr-xr-x     7 root     root         4096 Aug  1 15:01 www/
drwxr-xr-x     2 root     root         4096 Jul 17  2001 yp/

Let's assume we think the mail directory is the culprit that we want to move (although I'd suspect in your case it may be the /var/log directory)

[root@www var]# mkdir /usr/var-overflow/mail

(I already had a /usr/var-overflow directory)
Now we want to copy the /var/mail to it's new directory which is on another partition:

[root@www var]# cp -R mail/ /usr/var-overflow/

Remove the old /var/mail:

[root@www var]# rm -rf mail/

Create the symlink:

[root@www var]# ln -s /usr/var-overflow/mail/ mail
[root@www var]# ls -l
total 64
d-wx-wx-wt   2 apache   apache       4096 Sep 15  2003 apache-mm/
drwxr-xr-x     7 root     root         4096 Dec  4  2003 cache/
drwxrwxr-x  14 root     man          4096 Nov 29  2003 catman/
drwxr-xr-x     2 root     root         4096 Aug  5  1998 db/
drwxr-xr-x     2 root     root         4096 Sep 16  2003 empty/
drwxr-xr-x   18 root     root         4096 Nov 30  2003 lib/
drwxr-xr-x     2 root     root         4096 Feb  6  1996 local/
drwxrwxr-x    3 root     root         4096 Sep 15 04:06 lock/
lrwxrwxrwx   1 root     root           22 Aug 16 16:11 log -> /usr/var-overflow/log//
drwx------     2 root     root         4096 Dec 24  2003 lost+found/
lrwxrwxrwx   1 root     root           23 Sep 23 17:23 mail -> /usr/var-overflow/mail//
drwxr-xr-x     2 root     root         4096 Feb  6  1996 nis/
drwxr-xr-x     2 root     root         4096 Apr 13  2000 opt/
drwxr-xr-x     2 root     root         4096 Feb  6  1996 preserve/
drwxr-xr-x   10 root     root         4096 Sep 15 06:28 run/
drwxrwxrwt   3 root     root         4096 Sep 15 04:36 tmp/
drwxr-xr-x     7 root     root         4096 Aug  1 15:01 www/
drwxr-xr-x     2 root     root         4096 Jul 17  2001 yp/

and check our free space again:

[root@www var]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ide/host0/bus0/target0/lun0/part3
                      958M   78M  831M   9% /
/dev/ide/host0/bus0/target0/lun0/part1
                      471M  5.1M  442M   2% /boot
/dev/ide/host0/bus0/target0/lun0/part8
                      1.9G   36M  1.9G   2% /home
/dev/ide/host0/bus0/target0/lun0/part6
                      958M   68K  909M   1% /tmp
/dev/ide/host0/bus0/target0/lun0/part9
                      4.7G  1.6G  2.9G  36% /usr
/dev/ide/host0/bus0/target0/lun0/part5
                      958M  309M  601M  32% /var
/dev/ide/host0/bus0/target0/lun0/part7
                      958M  8.0K  909M   1% /var/tmp
[root@www var]#


Ahh, much better.  Only thing left to do now is possibly restart whatever was writing to the original /var/mail which would have been the local mail delivery agent.  If you move /var/log, you'd need to restart the syslog daemon and any other apps that may have been writing to the directory you moved during the brief time it didn't exist otherwise logging might stop.  Since you'll want to test the syntax of your new ip aliases anyway, I'd just reboot.  While it may not be necessary to reboot if the appropriate daemons are restarted, it *is* necessary to test bootup configuration changes while you can instead of waiting until an extended power outage that drains the UPS only to find out later that there was a typo.

0
 
LVL 9

Expert Comment

by:fixnix
ID: 12137554
Shoeman: I hope I didn't goof up on the ifconfig syntax...noticed later that the syntax I pasted from was written for 2.x and 3.0 FreeBSD versions  (http://www.defcon1.org/html/Networking_Articles/natdhowto-whisky/aps-filter/Sharity-Light/body_ip-aliasing.html)...not sure if anything changed there for current 5.x versions.  Let me know if they don't work and I'll do a lil more digging for 5.x syntax (or try 'man ifconfig' and see if the manual page gives you enough information)
0
 
LVL 9

Expert Comment

by:fixnix
ID: 12137572
Excuse me....version 4.10 (since you said you ran the latest production version.  5.x is the "technology release")
0
 

Author Comment

by:shoeman22
ID: 12138022
ok, I think the disk was my problem.  The "/" partition was at 109% capacity (how is that possible?!)...and you were right, it is the /log directory that was getting out of control.  With that in mind...what if this happens again...can I dump the /usr/var-overflow/log directory from time to time?  How do I do that safely?

I need to get another IP from my boss when he's out of a meeting.

Thanks so far for the help and the syntax you listed looks right...that's how I was attempting to do it earlier (except I didn't have the "alias" bit on the end).  I'll test it later this afternoon and let you know if everything is good.

One other note...you said I'd need to restart the syslog daemon...how would I accomplish that please?
0
 
LVL 4

Accepted Solution

by:
svindler earned 250 total points
ID: 12141000
To keep the address for next reboot you need to modify /etc/rc.conf:
Add (or change):
defaultrouter="209.161.7.201"
ifconfig_xl0="inet 209.161.7.202 netmask 255.255.255.248"
hostname="slinky.domainname.com"

Make sure you don't have a ifconfig_xl0="DHCP" afterwards. Change domainname.com to whatever you need.

The changes will be reread by doing "/etc/netstart"

Your nameserver should be in /etc/resolv.conf:
search domainname.com
nameserver 192.168.1.103

Your log files can be rotated using newsyslog, which is configured by /etc/newsyslog.conf. Do a "man newsyslog" and ask any questions after that.

Your disk can be more than 100% full because a part of the disk is reserved for priviledged processes, so that ordinary users will receive a disk full before system processes. See the -m parameter in "man newfs" and "man tunefs".
0
 
LVL 9

Assisted Solution

by:fixnix
fixnix earned 250 total points
ID: 12141810
Shoeman:

To restart syslog, I believe you can just do (as root):
     /etc/init.d/syslog restart

I'm pretty certain FreeBSD uses the etc/init.d style of starting and stopping processes....I'm still going from memory as I haven't used FreeBSD in years.  I'll usually use NetBSD on SMP machines or OpenBSD on single processor boxes when I choose a BSD variant.  Just a personal preference.

As for doing it again and again if something fills up again, once you move the log directory to another partition you likely won't need to worry about space issues anymore, but any time you do run out on any partition, you can apply the above techniques to move stuff around to the free space areas.  Of course, none of that would be necessary with appropriate system planning before partitioning the original install, but that's not always an easy task.  Years ago, I had a system that was partitioned out the way that made the most sense when the system was initially set up, then it's duties changed and an application using the /opt filesystem was installed.  Needless to say, since I had no /opt before, it went on the / partition and filled up almost immediately upon application install (again avoidable with attention to detail and realizing it was going to dump a lot in /opt....I should have made /opt symlink to another partition before the installation of that program).

You need to include the "alias" at the end of the ifconfig lines otherwise the ifconfig command will replace the current ip/netmask/broadcast/metric/etc with the new ifconfig line.

Glad you're getting it sorted out....post the results once you're done or get stuck again :)

Cheers.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Cannot join to domain 16 79
Website Routing Issue 3 34
Trying to make SNMP connection work 7 41
cisco switch stacking 6 34
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now