A problem about the default router - BSD

This is a discussion on A problem about the default router - BSD ; Hi, guys! My OS is FreeBSD6.2, when I restart my network service #/etc/rc.d/netif restart Then I cannot reach the internet, because the default router item is cleaned from the router table So I hvae to add it manually to the ...

+ Reply to Thread
Results 1 to 12 of 12

Thread: A problem about the default router

  1. A problem about the default router

    Hi, guys!
    My OS is FreeBSD6.2, when I restart my network service
    #/etc/rc.d/netif restart
    Then I cannot reach the internet, because the default router item is
    cleaned from the router table
    So I hvae to add it manually to the table, e.g
    #route add default 192.168.1.1
    But I hate to repeat always doing this. Do I make myself clear?
    I'm not familiar with FreeBSD, it's a little different from Linux.

  2. Re: A problem about the default router

    On Tue, 27 Nov 2007 15:11:49 +0800
    Scott wrote:

    >
    >
    > Hi, guys!
    > My OS is FreeBSD6.2, when I restart my network service
    > #/etc/rc.d/netif restart
    > Then I cannot reach the internet, because the default router item is
    > cleaned from the router table
    > So I hvae to add it manually to the table, e.g
    > #route add default 192.168.1.1
    > But I hate to repeat always doing this. Do I make myself clear?


    Edit /etc/rc.conf, add the line

    defaultrouter="192.168.1.1"

    Read man rc.conf for a rundown on other things you can do in there.

    --
    C:>WIN | Directable Mirror Arrays
    The computer obeys and wins. | A better way to focus the sun
    You lose and Bill collects. | licences available see
    | http://www.sohara.org/

  3. Re: A problem about the default router

    Begin
    On Tue, 27 Nov 2007 15:11:49 +0800, Scott wrote:
    > My OS is FreeBSD6.2, when I restart my network service
    > #/etc/rc.d/netif restart
    > Then I cannot reach the internet, because the default router item is
    > cleaned from the router table
    > So I hvae to add it manually to the table, e.g
    > #route add default 192.168.1.1


    The place to add it is /etc/rc.conf. Next to the ifconfig_xxx="..." add
    a line defaultrouter="...". See also: rc.conf(5).

    If your ifconfig_xxx line specifies DHCP, then it might be the dhcp
    server needs fixing instead.


    > But I hate to repeat always doing this. Do I make myself clear?
    > I'm not familiar with FreeBSD, it's a little different from Linux.


    Yes, very clear. Amazingly, FreeBSD does come with a handbook with
    all that documented. And of course, the manpage mentioned above.


    --
    j p d (at) d s b (dot) t u d e l f t (dot) n l .
    This message was originally posted on Usenet in plain text.
    Any other representation, additions, or changes do not have my
    consent and may be a violation of international copyright law.

  4. Re: A problem about the default router

    Steve O'Hara-Smith 写道:
    > On Tue, 27 Nov 2007 15:11:49 +0800
    > Scott wrote:
    >
    >>
    >> Hi, guys!
    >> My OS is FreeBSD6.2, when I restart my network service
    >> #/etc/rc.d/netif restart
    >> Then I cannot reach the internet, because the default router item is
    >> cleaned from the router table
    >> So I hvae to add it manually to the table, e.g
    >> #route add default 192.168.1.1
    >> But I hate to repeat always doing this. Do I make myself clear?

    >
    > Edit /etc/rc.conf, add the line
    >
    > defaultrouter="192.168.1.1"
    >
    > Read man rc.conf for a rundown on other things you can do in there.
    >

    I am sorry I forgot to show you the rc.conf file previously.
    #cat /etc/rc.local

    # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    # Created: Tue Nov 27 20:22:51 2007
    # Enable network daemons for user convenience.
    # Please make all changes to this file, not to /etc/defaults/rc.conf.
    # This file now contains just the overrides from /etc/defaults/rc.conf.
    defaultrouter="192.168.1.1"
    hostname="FreeBSD"
    ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    linux_enable="YES"
    moused_enable="YES"
    sshd_enable="YES"
    usbd_enable="YES"

    You can see above, line "defaultrouter" is already contained in the file.

  5. Re: A problem about the default router

    Bob Eager 写道:
    > On Tue, 27 Nov 2007 18:51:24 UTC, Scott wrote:
    >
    >> I am sorry I forgot to show you the rc.conf file previously.
    >> #cat /etc/rc.local
    >>
    >> # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    >> # Created: Tue Nov 27 20:22:51 2007
    >> # Enable network daemons for user convenience.
    >> # Please make all changes to this file, not to /etc/defaults/rc.conf.
    >> # This file now contains just the overrides from /etc/defaults/rc.conf.
    >> defaultrouter="192.168.1.1"
    >> hostname="FreeBSD"
    >> ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    >> linux_enable="YES"
    >> moused_enable="YES"
    >> sshd_enable="YES"
    >> usbd_enable="YES"
    >>
    >> You can see above, line "defaultrouter" is already contained in the file.

    >
    > yes, but that's rc.local. Not rc.conf.

    It's my careless misspelling.
    The content above is contained in /etc/rc.conf, not /etc/rc.local

  6. Re: A problem about the default router

    On Wed, 28 Nov 2007 02:51:24 +0800
    Scott wrote:

    > Steve O'Hara-Smith 写道:
    > > On Tue, 27 Nov 2007 15:11:49 +0800
    > > Scott wrote:
    > >
    > >>
    > >> Hi, guys!
    > >> My OS is FreeBSD6.2, when I restart my network service
    > >> #/etc/rc.d/netif restart
    > >> Then I cannot reach the internet, because the default router item is
    > >> cleaned from the router table
    > >> So I hvae to add it manually to the table, e.g
    > >> #route add default 192.168.1.1
    > >> But I hate to repeat always doing this. Do I make myself clear?

    > >
    > > Edit /etc/rc.conf, add the line
    > >
    > > defaultrouter="192.168.1.1"
    > >
    > > Read man rc.conf for a rundown on other things you can do in
    > > there.
    > >

    > I am sorry I forgot to show you the rc.conf file previously.
    > #cat /etc/rc.local

    ____________^^^^^^^^

    The contents are fine but the file should be /etc/rc.conf
    or /etc/rc.conf.local unless you alter rc_conf_files in /etc/rc.conf.

    --
    C:>WIN | Directable Mirror Arrays
    The computer obeys and wins. | A better way to focus the sun
    You lose and Bill collects. | licences available see
    | http://www.sohara.org/

  7. Re: A problem about the default router

    On Tue, 27 Nov 2007 18:51:24 UTC, Scott wrote:

    > I am sorry I forgot to show you the rc.conf file previously.
    > #cat /etc/rc.local
    >
    > # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    > # Created: Tue Nov 27 20:22:51 2007
    > # Enable network daemons for user convenience.
    > # Please make all changes to this file, not to /etc/defaults/rc.conf.
    > # This file now contains just the overrides from /etc/defaults/rc.conf.
    > defaultrouter="192.168.1.1"
    > hostname="FreeBSD"
    > ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    > linux_enable="YES"
    > moused_enable="YES"
    > sshd_enable="YES"
    > usbd_enable="YES"
    >
    > You can see above, line "defaultrouter" is already contained in the file.


    yes, but that's rc.local. Not rc.conf.
    --
    Bob Eager
    UNIX since v6..
    http://tinyurl.com/2xqr6h


  8. Re: A problem about the default router

    On 2007-11-27, Scott wrote:
    > Hi, guys!
    > My OS is FreeBSD6.2, when I restart my network service
    > #/etc/rc.d/netif restart
    > Then I cannot reach the internet, because the default router item is
    > cleaned from the router table
    > So I hvae to add it manually to the table, e.g
    > #route add default 192.168.1.1
    > But I hate to repeat always doing this. Do I make myself clear?
    > I'm not familiar with FreeBSD, it's a little different from Linux.


    I don't know if it's much better, but additionally I do:

    # /etc/routing restart

  9. Re: A problem about the default router

    On Wed, 28 Nov 2007 13:06:14 +0800
    Scott wrote:

    >
    >
    > Bob Eager 写道:
    > > On Tue, 27 Nov 2007 18:51:24 UTC, Scott wrote:
    > >
    > >> I am sorry I forgot to show you the rc.conf file previously.
    > >> #cat /etc/rc.local
    > >>
    > >> # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    > >> # Created: Tue Nov 27 20:22:51 2007
    > >> # Enable network daemons for user convenience.
    > >> # Please make all changes to this file, not to /etc/defaults/rc.conf.
    > >> # This file now contains just the overrides from /etc/defaults/rc.conf.
    > >> defaultrouter="192.168.1.1"
    > >> hostname="FreeBSD"
    > >> ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    > >> linux_enable="YES"
    > >> moused_enable="YES"
    > >> sshd_enable="YES"
    > >> usbd_enable="YES"
    > >>
    > >> You can see above, line "defaultrouter" is already contained in the
    > >> file.

    > >
    > > yes, but that's rc.local. Not rc.conf.

    > It's my careless misspelling.
    > The content above is contained in /etc/rc.conf, not /etc/rc.local


    If exactly that is in /etc/rc.conf it should work, it always has
    for me (ie. almost as long as there has been FreeBSD). Could you actually
    run the command cat /etc/rc.conf and paste (not type) the result into a
    posting, there pretty much has to be something silly eluding your eyes.

    --
    C:>WIN | Directable Mirror Arrays
    The computer obeys and wins. | A better way to focus the sun
    You lose and Bill collects. | licences available see
    | http://www.sohara.org/

  10. Re: A problem about the default router

    Steve O'Hara-Smith 写道:
    > On Wed, 28 Nov 2007 13:06:14 +0800
    > Scott wrote:
    >
    >>
    >> Bob Eager 写道:
    >>> On Tue, 27 Nov 2007 18:51:24 UTC, Scott wrote:
    >>>
    >>>> I am sorry I forgot to show you the rc.conf file previously.
    >>>> #cat /etc/rc.local
    >>>>
    >>>> # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    >>>> # Created: Tue Nov 27 20:22:51 2007
    >>>> # Enable network daemons for user convenience.
    >>>> # Please make all changes to this file, not to /etc/defaults/rc.conf.
    >>>> # This file now contains just the overrides from /etc/defaults/rc.conf.
    >>>> defaultrouter="192.168.1.1"
    >>>> hostname="FreeBSD"
    >>>> ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    >>>> linux_enable="YES"
    >>>> moused_enable="YES"
    >>>> sshd_enable="YES"
    >>>> usbd_enable="YES"
    >>>>
    >>>> You can see above, line "defaultrouter" is already contained in the
    >>>> file.
    >>> yes, but that's rc.local. Not rc.conf.

    >> It's my careless misspelling.
    >> The content above is contained in /etc/rc.conf, not /etc/rc.local

    >
    > If exactly that is in /etc/rc.conf it should work, it always has
    > for me (ie. almost as long as there has been FreeBSD). Could you actually
    > run the command cat /etc/rc.conf and paste (not type) the result into a
    > posting, there pretty much has to be something silly eluding your eyes.
    >

    I repeated what I did step by step:

    (STEP ONE)
    [root@FreeBSD ~]# netstat -r
    Routing tables

    Internet:
    Destination Gateway Flags Refs Use Netif Expire
    default 192.168.1.1 UGS 0 5 lnc0
    localhost.com localhost.com UH 0 0 lo0
    192.168.1 link#1 UC 0 0 lnc0
    192.168.1.1 00:11:95:11:ea:4c UHLW 2 0 lnc0 1177
    192.168.1.30 00:14:78:07:98:7f UHLW 1 74 lnc0 1186

    Internet6:
    Destination Gateway Flags Netif Expire
    localhost.com localhost.com UHL lo0
    fe80::%lo0 fe80::1%lo0 U lo0
    fe80::1%lo0 link#3 UHL lo0
    ff01:3:: fe80::1%lo0 UC lo0
    ff02::%lo0 fe80::1%lo0 UC lo0
    ------------------------------------------------------------------------
    (STEP TWO)
    [root@FreeBSD ~]# /etc/rc.d/netif restart
    Stopping network: lo0 lnc0 plip0.
    lo0: flags=8049 mtu 16384
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
    inet6 ::1 prefixlen 128
    inet 127.0.0.1 netmask 0xff000000
    lnc0: flags=108843
    mtu 1500
    inet 192.168.1.32 netmask 0xffffff00 broadcast 192.168.1.255
    ether 00:0c:29:45:98:d2
    ------------------------------------------------------------------------
    (STEP THREE)
    [root@FreeBSD ~]# netstat -r
    Routing tables

    Internet:
    Destination Gateway Flags Refs Use Netif Expire
    localhost.com localhost.com UH 0 0 lo0
    192.168.1 link#1 UC 0 0 lnc0
    192.168.1.30 00:14:78:07:98:7f UHLW 1 25 lnc0 1186

    Internet6:
    Destination Gateway Flags Netif Expire
    localhost.com localhost.com UHL lo0
    fe80::%lo0 fe80::1%lo0 U lo0
    fe80::1%lo0 link#3 UHL lo0
    ff01:3:: fe80::1%lo0 UC lo0
    ff02::%lo0 fe80::1%lo0 UC lo0
    -----------------------------------------------------------------------
    (STEP FOUR)
    [root@FreeBSD ~]# cat /etc/rc.conf

    # -- sysinstall generated deltas -- # Tue Nov 27 20:22:51 2007
    # Created: Tue Nov 27 20:22:51 2007
    # Enable network daemons for user convenience.
    # Please make all changes to this file, not to /etc/defaults/rc.conf.
    # This file now contains just the overrides from /etc/defaults/rc.conf.
    defaultrouter="192.168.1.1"
    hostname="FreeBSD"
    ifconfig_lnc0="inet 192.168.1.32 netmask 255.255.255.0"
    linux_enable="YES"
    moused_enable="YES"
    sshd_enable="YES"
    usbd_enable="YES"
    ------------------------------------------------------------------------
    So what's the problem? I am confused

  11. Re: A problem about the default router

    On Thu, 29 Nov 2007 07:30:03 +0800
    Scott wrote:

    > I repeated what I did step by step:
    >
    > (STEP ONE)
    > [root@FreeBSD ~]# netstat -r
    > Routing tables
    >
    > Internet:
    > Destination Gateway Flags Refs Use Netif Expire
    > default 192.168.1.1 UGS 0 5 lnc0
    > localhost.com localhost.com UH 0 0 lo0
    > 192.168.1 link#1 UC 0 0 lnc0
    > 192.168.1.1 00:11:95:11:ea:4c UHLW 2 0 lnc0 1177
    > 192.168.1.30 00:14:78:07:98:7f UHLW 1 74 lnc0 1186
    >
    > Internet6:
    > Destination Gateway Flags Netif Expire
    > localhost.com localhost.com UHL lo0
    > fe80::%lo0 fe80::1%lo0 U lo0
    > fe80::1%lo0 link#3 UHL lo0
    > ff01:3:: fe80::1%lo0 UC lo0
    > ff02::%lo0 fe80::1%lo0 UC lo0
    > ------------------------------------------------------------------------
    > (STEP TWO)
    > [root@FreeBSD ~]# /etc/rc.d/netif restart
    > Stopping network: lo0 lnc0 plip0.
    > lo0: flags=8049 mtu 16384
    > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
    > inet6 ::1 prefixlen 128
    > inet 127.0.0.1 netmask 0xff000000
    > lnc0: flags=108843
    > mtu 1500
    > inet 192.168.1.32 netmask 0xffffff00 broadcast 192.168.1.255
    > ether 00:0c:29:45:98:d2
    > ------------------------------------------------------------------------


    After this you'll need to run

    /etc/rc.d/routing restart

    In order to apply the routes from rc.conf.

    > So what's the problem? I am confused


    Stopping the interfaces cleared the routes (side effect), so you
    need to restart routing to get them back.

    --
    C:>WIN | Directable Mirror Arrays
    The computer obeys and wins. | A better way to focus the sun
    You lose and Bill collects. | licences available see
    | http://www.sohara.org/

  12. Re: A problem about the default router

    Steve O'Hara-Smith 写道:
    > On Thu, 29 Nov 2007 07:30:03 +0800
    > Scott wrote:
    >
    >> I repeated what I did step by step:
    >>
    >> (STEP ONE)
    >> [root@FreeBSD ~]# netstat -r
    >> Routing tables
    >>
    >> Internet:
    >> Destination Gateway Flags Refs Use Netif Expire
    >> default 192.168.1.1 UGS 0 5 lnc0
    >> localhost.com localhost.com UH 0 0 lo0
    >> 192.168.1 link#1 UC 0 0 lnc0
    >> 192.168.1.1 00:11:95:11:ea:4c UHLW 2 0 lnc0 1177
    >> 192.168.1.30 00:14:78:07:98:7f UHLW 1 74 lnc0 1186
    >>
    >> Internet6:
    >> Destination Gateway Flags Netif Expire
    >> localhost.com localhost.com UHL lo0
    >> fe80::%lo0 fe80::1%lo0 U lo0
    >> fe80::1%lo0 link#3 UHL lo0
    >> ff01:3:: fe80::1%lo0 UC lo0
    >> ff02::%lo0 fe80::1%lo0 UC lo0
    >> ------------------------------------------------------------------------
    >> (STEP TWO)
    >> [root@FreeBSD ~]# /etc/rc.d/netif restart
    >> Stopping network: lo0 lnc0 plip0.
    >> lo0: flags=8049 mtu 16384
    >> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
    >> inet6 ::1 prefixlen 128
    >> inet 127.0.0.1 netmask 0xff000000
    >> lnc0: flags=108843
    >> mtu 1500
    >> inet 192.168.1.32 netmask 0xffffff00 broadcast 192.168.1.255
    >> ether 00:0c:29:45:98:d2
    >> ------------------------------------------------------------------------

    >
    > After this you'll need to run
    >
    > /etc/rc.d/routing restart
    >
    > In order to apply the routes from rc.conf.
    >
    >> So what's the problem? I am confused

    >
    > Stopping the interfaces cleared the routes (side effect), so you
    > need to restart routing to get them back.
    >

    Now it works!
    Thanks you, Steve, and all friends involved in this topic.

+ Reply to Thread