Re: Better way to get interface assigned to default route?

2004-09-04 Thread Markie

- Original Message -
From: "Remko Lodder" <[EMAIL PROTECTED]>
To: "Markie" <[EMAIL PROTECTED]>
Sent: Saturday, September 04, 2004 11:17 PM
Subject: Re: Better way to get interface assigned to default route?


| Markie wrote:
|
| > Suggesting I do `dhclient fxp1`? That's exactly my problem though :-)
That
| > uses /sbin/dhclient-script to do all of it's work, right?
dhclient-script
| > tries to figure out the interface... or something to do with a default
| > route by doing that netstat -rn command.
| >
| > dhclient-script snippet...
| > 
| > if [ x$alias_subnet_mask != x ]; then
| >   alias_subnet_arg="netmask $alias_subnet_mask"
| > fi
| >
| > # Get the interface to which our default route is bound to.
| > if [ -x /usr/bin/netstat ]; then
| >if_defaultroute=`/usr/bin/netstat -rn \
| >| /usr/bin/grep "^default" \
| >| /usr/bin/awk '{print $6}'`
| > else
| > if_defaultroute="x"
| > fi
| >
| > if [ x$reason = xMEDIUM ]; then
| >   eval "ifconfig $interface $medium"
| >   eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null
2>&1
| >   sleep 1
| >   exit_with_hooks 0
| > fi
| > ---
| >
| > See it? Basically I am after some sort of command that might be able to
get
| > the interface with the default route assigned but quicker than
netstat -rn
| > since I have alot of routing table entries. Like I said, if there's no
| > other way I will just have to fix it so it's if_defaultroute = "fxp1".
| >
| > I've already had to make some changes to the script to get it to work
with
| > my modem anyway so it won't hurt me :-) I was just wondering if there
was
| > any other nice way of doing it so that say if I changed the internet
| > interface to a vx card I wouldn't have to try and remember to change
that
| > to vx0 (I _will_ forget I made the change :-)
| >
|

Hi Remko :-)

| Well, how come there is a default route if you use dhcp afterwards? my
| default route is delivered through dhcp.. so i cannot reside on a
| default entry because i dont have any... That's why i think that the
| default grep is a little bit weird actually, since most hosts dont have
| any routes at all at that point in time and then start dhclient 
|

I'm no expert on it all, but... the command is in the code and it's
certainly executing that command :-) I see it in top taking up alot of CPU
time every few minutes! I imagine it's doing it every few minutes because
my modem likes to send dhcp updates frequently, so if my connection drops
or ip changes I don't have to wait an hour... day...however long for the
interface to be updated.

| And to be  more exact:
|
| in /etc/rc.conf i have
| ifconfig_em0="DHCP" which starts ``dhclient em0'' for me... i never used
| dhclient-script, and didn't read it carefully yet to understand it.
|

Yeah, I have ifconfig_fxp1="DHCP" :-) dhclient uses dhclient-script to do
all of it's work, I guess you could call dhclient a wrapper of sorts?

Like I said, I had to make some changes to this script, although I have
never execute it directly, to stop FreeBSD from locking up on an IP address
change and to actually even get it to be able to communicate with my modem
(ADSLNation X-Modem CE), something along the lines of deleting the default
route straight after it had added it, and then readding it; don't ask me
why this solved the problem but it did! If anyone is interested in that I
can mail the changes I made and describe my setup or something. Infact, to
back that up further here's a snippet from the dhclient-script man page :-D

-
dhclient-script(8)
dhclient-script(8)

NAME
   dhclient-script - DHCP client network configuration script

DESCRIPTION
   The  DHCP  client  network configuration script is invoked from time
to
   time by dhclient(8).
-

I guess you probably just don't notice because you have a fast machine and
not many routing table entries?

| Perhaps this explains a bit...
|
| or i just dont get the question yet { have a long weekend, tired etc ;) }

:-) No worries, I am very grateful for your reply!

|
| Cheers dude!
|
| --
| Kind regards,
|
| Remko Lodder   |[EMAIL PROTECTED]
| Reporter DSINet|[EMAIL PROTECTED]
| Projectleader Mostly-Harmless  |[EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Better way to get interface assigned to default route?

2004-09-04 Thread Remko Lodder
Hi,
Markie forgot, and forwared this to the list, i forgot and didn't notice 
 it until now that it also had been sent to the list by Markie. So, i 
will 'reply' this message to the Questions list as well just to keep you 
guys and the archive updated.

Cheers!

Remko Lodder wrote:
Markie wrote:
Suggesting I do `dhclient fxp1`? That's exactly my problem though :-) 
That
uses /sbin/dhclient-script to do all of it's work, right? dhclient-script
tries to figure out the interface... or something to do with a default
route by doing that netstat -rn command.

dhclient-script snippet...

if [ x$alias_subnet_mask != x ]; then
  alias_subnet_arg="netmask $alias_subnet_mask"
fi
# Get the interface to which our default route is bound to.
if [ -x /usr/bin/netstat ]; then
   if_defaultroute=`/usr/bin/netstat -rn \
   | /usr/bin/grep "^default" \
   | /usr/bin/awk '{print $6}'`
else
if_defaultroute="x"
fi
if [ x$reason = xMEDIUM ]; then
  eval "ifconfig $interface $medium"
  eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
  sleep 1
  exit_with_hooks 0
fi
---
See it? Basically I am after some sort of command that might be able 
to get
the interface with the default route assigned but quicker than netstat 
-rn
since I have alot of routing table entries. Like I said, if there's no
other way I will just have to fix it so it's if_defaultroute = "fxp1".

I've already had to make some changes to the script to get it to work 
with
my modem anyway so it won't hurt me :-) I was just wondering if there was
any other nice way of doing it so that say if I changed the internet
interface to a vx card I wouldn't have to try and remember to change that
to vx0 (I _will_ forget I made the change :-)

Well, how come there is a default route if you use dhcp afterwards? my 
default route is delivered through dhcp.. so i cannot reside on a 
default entry because i dont have any... That's why i think that the 
default grep is a little bit weird actually, since most hosts dont have 
any routes at all at that point in time and then start dhclient 

And to be  more exact:
in /etc/rc.conf i have
ifconfig_em0="DHCP" which starts ``dhclient em0'' for me... i never used 
dhclient-script, and didn't read it carefully yet to understand it.

Perhaps this explains a bit...
or i just dont get the question yet { have a long weekend, tired etc ;) }
Cheers dude!

--
Kind regards,
Remko Lodder   |[EMAIL PROTECTED]
Reporter DSINet|[EMAIL PROTECTED]
Projectleader Mostly-Harmless  |[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Better way to get interface assigned to default route?

2004-09-04 Thread Markie
Stupid me forgot to forward it back to the list, hit the wrong button.
Sorry :-D

- Original Message -
From: "Markie" <[EMAIL PROTECTED]>
To: "Remko Lodder" <[EMAIL PROTECTED]>
Sent: Saturday, September 04, 2004 6:15 PM
Subject: Re: Better way to get interface assigned to default route?


| - Original Message -
| From: "Remko Lodder" <[EMAIL PROTECTED]>
| To: "Markie" <[EMAIL PROTECTED]>
| Cc: <[EMAIL PROTECTED]>
| Sent: Saturday, September 04, 2004 5:23 PM
| Subject: Re: Better way to get interface assigned to default route?
|
|
| | Hi Markie,
| |
| | Markie wrote:
| |
| | > Hi all,
| | >
| | > I just now replaced my 350MHz PII home server back to the old 133MHz
PI
| to
| | > see if my crashing problems went away. I have noticed that
| dhclient-script
| | > does a `netstat -rn | grep "^default" | awk {'print $6'}` to get the
| | > interface that the default route is on, in my case my dsl modem is on
| fxp1.
| | > Since this is a slow machine however, this takes a very long time for
| it to
| | > do that command as I seem to have quite alot of...routing entries I
| guess
| | > they are?
| |
| | Okay it seems to me that you want to use DHCP in order to get your ass
| | (machine) in the internet. That seems rather logically, only i use the
| | dhclient  command (dhclient rl0 for example). To me it
sounds
|
| Suggesting I do `dhclient fxp1`? That's exactly my problem though :-)
That
| uses /sbin/dhclient-script to do all of it's work, right? dhclient-script
| tries to figure out the interface... or something to do with a default
| route by doing that netstat -rn command.
|
| dhclient-script snippet...
| 
| if [ x$alias_subnet_mask != x ]; then
|   alias_subnet_arg="netmask $alias_subnet_mask"
| fi
|
| # Get the interface to which our default route is bound to.
| if [ -x /usr/bin/netstat ]; then
|if_defaultroute=`/usr/bin/netstat -rn \
|| /usr/bin/grep "^default" \
|| /usr/bin/awk '{print $6}'`
| else
| if_defaultroute="x"
| fi
|
| if [ x$reason = xMEDIUM ]; then
|   eval "ifconfig $interface $medium"
|   eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1
|   sleep 1
|   exit_with_hooks 0
| fi
| ---
|
| See it? Basically I am after some sort of command that might be able to
get
| the interface with the default route assigned but quicker than
netstat -rn
| since I have alot of routing table entries. Like I said, if there's no
| other way I will just have to fix it so it's if_defaultroute = "fxp1".
|
| I've already had to make some changes to the script to get it to work
with
| my modem anyway so it won't hurt me :-) I was just wondering if there was
| any other nice way of doing it so that say if I changed the internet
| interface to a vx card I wouldn't have to try and remember to change that
| to vx0 (I _will_ forget I made the change :-)
|
| | rather silly to do a netstat -rn command, checkup the default route
| | interface and then add dhcp stuff into it.. since dhcp sets these
| | default route for me..
| |
| | Perhaps you can try and see if that works quicker :)
| |
| | Cheers
| |
| |
|
| Thanks
|
| | --
| | Kind regards,
| |
| | Remko Lodder   |[EMAIL PROTECTED]
| | Reporter DSINet|[EMAIL PROTECTED]
| | Projectleader Mostly-Harmless  |[EMAIL PROTECTED]
|

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Better way to get interface assigned to default route?

2004-09-04 Thread Remko Lodder
Hi Markie,
Markie wrote:
Hi all,
I just now replaced my 350MHz PII home server back to the old 133MHz PI to
see if my crashing problems went away. I have noticed that dhclient-script
does a `netstat -rn | grep "^default" | awk {'print $6'}` to get the
interface that the default route is on, in my case my dsl modem is on fxp1.
Since this is a slow machine however, this takes a very long time for it to
do that command as I seem to have quite alot of...routing entries I guess
they are?
Okay it seems to me that you want to use DHCP in order to get your ass 
(machine) in the internet. That seems rather logically, only i use the 
dhclient  command (dhclient rl0 for example). To me it sounds 
rather silly to do a netstat -rn command, checkup the default route 
interface and then add dhcp stuff into it.. since dhcp sets these 
default route for me..

Perhaps you can try and see if that works quicker :)
Cheers
--
Kind regards,
Remko Lodder   |[EMAIL PROTECTED]
Reporter DSINet|[EMAIL PROTECTED]
Projectleader Mostly-Harmless  |[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: better way

2003-11-02 Thread Lowell Gilbert
"SWIT" <[EMAIL PROTECTED]> writes:

> I was wondering what happens or the consequences of this.
> I made a /temp on the install of FreeBSD 4.8
> I untar all the programs to that point I want to install. LIke apache,
> mysql. php or postnuke etc.
> Then go to /temp/whaterver and do the ./configures/makes etc.

The FreeBSD ports system is a far better way of doing this.
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html
You can always do it on your own, as you have, but cleaning up
afterwards (and reinstalling if you want to update to a new version)
are your own problem, and the FreeBSD tools to make these processes
easy will not be available.

> I had to remove all those directories for space. I never had removed them
> after doing the installs. There were like 30-40 of them.
> I was then wondering about what if I fubar my apache or php or mysql and
> need to reinstall. ?
> Am I okay in that I can untar and redo the install process ? Or do they need
> the original compile I did ?
> And what happens if I want to add some options to the compile/make process
> after I have removed the directories from the original install or need to
> recompile with a new configure option ?

You can always just build it over, with any options you want.  If you
want to remove it, however, you will be on your own to figure out what
got installed and delete it.  If you want to upgrade, there will be a
similar issue because files left behind by the old install of the
program could confuse the new install.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"