two dc cards on 5.4

Matthew Seaman m.seaman at infracaninophile.co.uk
Thu Aug 11 10:17:17 GMT 2005


On Wed, Aug 10, 2005 at 05:33:30PM -0700, Sean Murphy wrote:
> Sean Murphy wrote:
> >dave wrote:
> >
> >>Hi,
> >>    Thanks for your reply. I'll give that a shot. My problem is the 
> >>dc0 card
> >>gets it's ip via dhcp, can i still use media and mediaopt with dhcp?
> >>Thanks.
> >>Dave.
> >>
> >>_______________________________________________
> >>freebsd-questions at freebsd.org mailing list
> >>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> >>To unsubscribe, send any mail to 
> >>"freebsd-questions-unsubscribe at freebsd.org"
> >>
> >
> >try this in your rc.conf
> >
> >ifconfig_dc0="DHCP"
> >ifconfig_dc0="100baseTX mediaopt full-duplex"
> >
> >ifconfig_dc1="DHCP"
> >ifconfig_dc1="100baseTX mediaopt full-duplex"
> >
> >
> 
> *Correction*
> 
> ifconfig_dc0="DHCP"
> ifconfig_dc0="media 100baseTX mediaopt full-duplex"
> 
> ifconfig_dc1="DHCP"
> ifconfig_dc1="media 100baseTX mediaopt full-duplex"

Unfortunately, that won't work.  /etc/rc.conf is part of a shell
script, and all of those variable=value lines within it are literally
assignments to shell variables.  Thus all you're doing with those
lines is setting 'ifconfig_dcX' to the value "DHCP" and then
immediately resetting it to the value "media 100baseTX mediaopt
full-duplex".

On recent FreeBSD 6.x you can just combine the lines:

    ifconfig_dc0="DHCP media 100baseTX mediaopt full-duplex"

(I can't remember if that also works on 5.x -- you'll need to read
/etc/network.subr to find out).

In any case, and certainly for older FreeBSD versions you can always
create a /etc/start_if.dc0 script, which will be run immediately
before the ifconfig(8) command generated out of /etc/rc.conf.  In your
case, the script should look like:

    #!/bin/sh

    ifconfig dc0 media 100baseTX mediaopt full-duplex

but you can put any arbitrary commands in there that you want.  Ditto
for the dc1 interface, except call the script /etc/start_if.dc1 (if
that isn't bleedingly obvious...)  There are corresponding
/etc/stop_if.XXN scripts that can be created to do arbitrary stuff on
interface shutdown as well.

   Cheers,

   Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       8 Dane Court Manor
                                                      School Rd
PGP: http://www.infracaninophile.co.uk/pgpkey         Tilmanstone
Tel: +44 1304 617253                                  Kent, CT14 0JL UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050811/50b70032/attachment.bin


More information about the freebsd-questions mailing list