ifdown/ifup under FreeBSD?

464 views
Skip to first unread message

Sandra Kachelmann

unread,
Dec 17, 2009, 9:09:18 AM12/17/09
to ques...@freebsd.org
Under RedHat Linux I can configure an interface, routes and so on in
/etc/sysconfig/network-scripts/ifcfg-eth1,
/etc/sysconfig/network-scripts/routes-eth1 then simply run:

$ ifup eth1

and it will set all the routes/netconfig/aliases I just configured.

Is there something similar in FreeBSD?

I tried configuring aliases in /etc/rc.conf and running:

$ /etc/rc.d/netif restart

but that just ended in errors that the route was already configured
and so on. Sure I could do all the work manually with ifconfig and
route but that's not my question.

Sandra
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Ivan Voras

unread,
Dec 17, 2009, 9:13:39 AM12/17/09
to freebsd-...@freebsd.org
Sandra Kachelmann wrote:

> $ /etc/rc.d/netif restart
>
> but that just ended in errors that the route was already configured
> and so on. Sure I could do all the work manually with ifconfig and
> route but that's not my question.

Maybe you also need "/etc/rc.d/routing restart"?

Bas Smeelen

unread,
Dec 17, 2009, 9:17:07 AM12/17/09
to freebsd-...@freebsd.org
Sandra Kachelmann wrote:
> Under RedHat Linux I can configure an interface, routes and so on in
> /etc/sysconfig/network-scripts/ifcfg-eth1,
> /etc/sysconfig/network-scripts/routes-eth1 then simply run:
>
> $ ifup eth1
>
> and it will set all the routes/netconfig/aliases I just configured.
>
> Is there something similar in FreeBSD?
>
> I tried configuring aliases in /etc/rc.conf and running:
>
> $ /etc/rc.d/netif restart
>
> but that just ended in errors that the route was already configured
> and so on. Sure I could do all the work manually with ifconfig and
> route but that's not my question.
>
Usually I do this from remote with /etc/rc.d/netif restart &&
/etc/rc.d/routing restart &
Maybe you are not root (because of the $ prompt)?
#/etc/rc.d/netif restart && /etc/rc.d/routing restart &
This always works for me

DISCLAIMER:
This e-mail is for the intended recipient(s) only

If you have received it by mistake please let us know by reply and then delete it from your system;
Access, disclosure, copying, distribution or reliance on any of it by anyone else is prohibited.

If you as intended recipient have received this e-mail incorrectly, please notify the sender (via e-mail).

Bas Smeelen

unread,
Dec 17, 2009, 9:19:13 AM12/17/09
to freebsd-...@freebsd.org
Bas Smeelen wrote:
> Sandra Kachelmann wrote:
>
>> Under RedHat Linux I can configure an interface, routes and so on in
>> /etc/sysconfig/network-scripts/ifcfg-eth1,
>> /etc/sysconfig/network-scripts/routes-eth1 then simply run:
>>
>> $ ifup eth1
>>
>> and it will set all the routes/netconfig/aliases I just configured.
>>
>> Is there something similar in FreeBSD?
>>
>> I tried configuring aliases in /etc/rc.conf and running:
>>
>> $ /etc/rc.d/netif restart
>>
>> but that just ended in errors that the route was already configured
>> and so on. Sure I could do all the work manually with ifconfig and
>> route but that's not my question.
>>
>>
> Usually I do this from remote with /etc/rc.d/netif restart &&
> /etc/rc.d/routing restart &
> Maybe you are not root (because of the $ prompt)?
> #/etc/rc.d/netif restart && /etc/rc.d/routing restart &
> This always works for me
>
Sorry, omit the last &

Ricardo Jesus

unread,
Dec 17, 2009, 9:49:09 AM12/17/09
to Bas Smeelen, freebsd-...@freebsd.org
The configuration files you're looking are /etc/resolv.conf and
/etc/rc.conf.

The start/stop scripts are /etc/rc.d/routing and /etc/rc.d/netif
respectively. You can view then to check out what arguments they accept
(restart, stop, etc).

You can have a look at man resolv.conf and rc.conf man pages for more info.

Sandra Kachelmann

unread,
Dec 17, 2009, 9:56:37 AM12/17/09
to ques...@freebsd.org
On Thu, Dec 17, 2009 at 3:46 PM, Igor V. Ruzanov <ig...@canmos.ru> wrote:
> |Under RedHat Linux I can configure an interface, routes and so on in
> |/etc/sysconfig/network-scripts/ifcfg-eth1,
> |/etc/sysconfig/network-scripts/routes-eth1 then simply run:
> |
> |$ ifup eth1
> |
> |and it will set all the routes/netconfig/aliases I just configured.
> |
> |Is there something similar in FreeBSD?
> |
> |I tried configuring aliases in /etc/rc.conf and running:
> |
> |$ /etc/rc.d/netif restart
> |
> |but that just ended in errors that the route was already configured
> |and so on. Sure I could do all the work manually with ifconfig and
> |route but that's not my question.
> |
> Under FreeBSD (as well as under Linux) you could use Zebra (Zebra/Quagga
> projects) to configure any interfaces/routing specific things.

I try to avoid doing complex routing things on my servers. I leave
that up to the NOC guys. They can do that on their fancy cisco
switches. I want just one route per interface :-)

I just wanted to add a seperate route/ip for the second interface,
make it permanent by adding it to /etc/rc.conf and tell my FreeBSD to
pretend it's booting up by running /etc/rc.d/netif restart. As others
pointed out I forgot /etc/rc.d/route.

Sandra Kachelmann

unread,
Dec 17, 2009, 9:35:50 AM12/17/09
to Bas Smeelen, freebsd-...@freebsd.org
On Thu, Dec 17, 2009 at 3:17 PM, Bas Smeelen <b.sm...@ose.nl> wrote:
> Sandra Kachelmann wrote:
>> Under RedHat Linux I can configure an interface, routes and so on in
>> /etc/sysconfig/network-scripts/ifcfg-eth1,
>> /etc/sysconfig/network-scripts/routes-eth1 then simply run:
>>
>> $ ifup eth1
>>
>> and it will set all the routes/netconfig/aliases I just configured.
>>
>> Is there something similar in FreeBSD?
>>
>> I tried configuring aliases in /etc/rc.conf and running:
>>
>> $ /etc/rc.d/netif restart
>>
>> but that just ended in errors that the route was already configured
>> and so on. Sure I could do all the work manually with ifconfig and
>> route but that's not my question.
>>
> Usually I do this from remote with /etc/rc.d/netif restart &&
> /etc/rc.d/routing restart &
> Maybe you are not root (because of the $ prompt)?
> #/etc/rc.d/netif restart && /etc/rc.d/routing restart &
> This always works for me

I was root but I didn't think of '/etc/rc.d/routing' also thanks to Ivan.

Sandra

Igor V. Ruzanov

unread,
Dec 17, 2009, 9:46:13 AM12/17/09
to Sandra Kachelmann, ques...@freebsd.org
|Under RedHat Linux I can configure an interface, routes and so on in
|/etc/sysconfig/network-scripts/ifcfg-eth1,
|/etc/sysconfig/network-scripts/routes-eth1 then simply run:
|
|$ ifup eth1
|
|and it will set all the routes/netconfig/aliases I just configured.
|
|Is there something similar in FreeBSD?
|
|I tried configuring aliases in /etc/rc.conf and running:
|
|$ /etc/rc.d/netif restart
|
|but that just ended in errors that the route was already configured
|and so on. Sure I could do all the work manually with ifconfig and
|route but that's not my question.
|
Under FreeBSD (as well as under Linux) you could use Zebra (Zebra/Quagga
projects) to configure any interfaces/routing specific things.

+-------------------------------------------+
! CANMOS ISP Network !
+-------------------------------------------+
! Best regards !
! Igor V. Ruzanov, network operational staff!
! e-Mail: ig...@canmos.ru !
+-------------------------------------------+

Greg Larkin

unread,
Dec 17, 2009, 10:17:55 AM12/17/09
to Sandra Kachelmann, ques...@freebsd.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sandra Kachelmann wrote:
> On Thu, Dec 17, 2009 at 3:46 PM, Igor V. Ruzanov <ig...@canmos.ru> wrote:
>> |Under RedHat Linux I can configure an interface, routes and so on in
>> |/etc/sysconfig/network-scripts/ifcfg-eth1,
>> |/etc/sysconfig/network-scripts/routes-eth1 then simply run:
>> |
>> |$ ifup eth1
>> |
>> |and it will set all the routes/netconfig/aliases I just configured.
>> |
>> |Is there something similar in FreeBSD?
>> |
>> |I tried configuring aliases in /etc/rc.conf and running:
>> |
>> |$ /etc/rc.d/netif restart
>> |
>> |but that just ended in errors that the route was already configured
>> |and so on. Sure I could do all the work manually with ifconfig and
>> |route but that's not my question.
>> |
>> Under FreeBSD (as well as under Linux) you could use Zebra (Zebra/Quagga
>> projects) to configure any interfaces/routing specific things.
>
> I try to avoid doing complex routing things on my servers. I leave
> that up to the NOC guys. They can do that on their fancy cisco
> switches. I want just one route per interface :-)
>
> I just wanted to add a seperate route/ip for the second interface,
> make it permanent by adding it to /etc/rc.conf and tell my FreeBSD to
> pretend it's booting up by running /etc/rc.d/netif restart. As others
> pointed out I forgot /etc/rc.d/route.
>
> Sandra

Hi all,

I use "/etc/netstart", since it includes all of the commands listed
previously, as well as others that start the DHCP client, firewall, etc.

Regards,
Greg
- --
Greg Larkin

http://www.FreeBSD.org/ - The Power To Serve
http://www.sourcehosting.net/ - Ready. Set. Code.
http://twitter.com/sourcehosting/ - Follow me, follow you
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLKkuj0sRouByUApARAh+yAJ9BDz1Bo+7sBvDL0zZp+tz8J3R+twCgh+jj
6O0Z/CzmMdvm6ZOhIYCED/o=
=ZSP1
-----END PGP SIGNATURE-----

Sandra Kachelmann

unread,
Dec 18, 2009, 4:36:55 AM12/18/09
to gla...@freebsd.org, ques...@freebsd.org

That's what i was looking for. How do you use it correctly? Just "sh
/etc/netstart"?

Sandra

Bas Smeelen

unread,
Dec 18, 2009, 5:06:40 AM12/18/09
to freebsd-...@freebsd.org
That should work.
But read the contents of the file.
It does not restart anything, just start

Quote:
# This file is NOT called by any of the other scripts - it has been
# obsoleted by /etc/rc.d/* and is provided here only for user
# convenience (if you're sitting in single user mode and wish to start
# the network by hand, this script will do it for you).

It seems like I loose my remote connection when doing it this way due to
ipfw which I normally restart with #sh /etc/ipfw.rules & so I don't lose
my connection
#sh /etc/netstart &
or
#sh /etc/netstart
both connection lost

So after a config change of ip and gateway I prefer the netif and
routing option


DISCLAIMER:
This e-mail is for the intended recipient(s) only
If you have received it by mistake please let us know by reply and then delete it from your system;
Access, disclosure, copying, distribution or reliance on any of it by anyone else is prohibited.

_______________________________________________

Reply all
Reply to author
Forward
0 new messages