Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 00:42:30 -0400 (EDT)
From:      Jim Durham <durham@jcdurham.com>
To:        George Hartzell <hartzell@kestrel.alerce.com>
Cc:        <freebsd-mobile@FreeBSD.ORG>
Subject:   Re: Help me translate a linux habit to a Freebsd 4.5-p5 laptop.
Message-ID:  <Pine.BSF.4.33.0205300031181.384-100000@jimslaptop.int>
In-Reply-To: <15605.20108.605502.219635@rosebud.alerce.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 May 2002, George Hartzell wrote:

>
> Under Redhat Linux 7.2, a network interface can be set up so that it
> isn't started when the machine boots, but rather when someone runs a
> command like:
>
>   ifup eth0
>
> If eth0 is config'ed with fixed addresses, it'll just set 'em, and if
> it's set up to use DHCP, it'll go set itself up appropriately.
>
> I find this handy with my laptop, since I'm frequently running around
> disconnected and having the interface down keeps me from having to
> wait while a bunch of stuff tries to use it.  When I show up at some
> place w/ a cable, I just plug in, ifup, and away I go.  When I'm done,
> ifdown eth0 and it drops the routes, removes the entries from
> /etc/resolv.conf, etc....
>
> In this case (sony vaio 505je or hsk), it's a built in fxp0 interface.
>

ifup and ifdown are scripts, I believe.

ifconfig fxp0 down will "down" the interface and ifconfig fxp0 up
will "up" it, but does nothing with routes or resolv.conf. Assigning
an address "ups" it automatically.

ifup for freebsd could be something like

ifconfig fxp0 192.168.1.100 netmask 255.255.255.0
route add default 192.168.1.1
echo "111.222.111.222" >> /etc/resolv.conf

ifdown would be the opposite

ifconfig fxp0 down
route delete default
cp /dev/null /etc/resolv.conf

I run my laptop with two docks, a wireless card and a pcmcia ethernet
card and use DHCP, so it works just fine disconnected.

'dhclient fxp0' would do the job there to bring it up. So, you
could have a different script for locations with DHCP.

You could also do a script that passed the IP, netmask and gateway
down as command line arguments, allowing multiple addresses for
multiple locations and detected "DHCP" as an argument to invoke
dhclient.

This is "*nix". Most things are possible!

-Jim Durham







To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0205300031181.384-100000>