1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rc.conf setting are lost after netif restart

Discussion in 'General' started by lavi0007, Sep 22, 2012.

  1. lavi0007

    lavi0007 New Member

    Messages:
    5
    Likes Received:
    0
    Hello,

    I've installed freebsd on virtualbox. I configured the network settings and default route on it. But after I do a machine restart or I just restart /etc/rc.d/netif restart. The default route and ip address assigned to the interface gets erased. Please help, what could be causing this.
     
  2. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,209
    Likes Received:
    15
    Have you removed the install CD image so the VM doesn't boot from that every time?
    Please show the exact changes you made, and to which file.
    Is the VM disk image set to be immutable?
     
  3. lavi0007

    lavi0007 New Member

    Messages:
    5
    Likes Received:
    0
    Hi,

    So I'm booting from harddisk, rest of the other settings are saved
    I assign IP:

    Code:
    ifconfig em0 192.168.1.10/24
    route add default 192.168.1.1
    
    When I do /etc/rc.d/netif restart, all the settings are gone....
     
  4. lavi0007

    lavi0007 New Member

    Messages:
    5
    Likes Received:
    0
    I also tried to add entry under /etc/rc.conf

    Code:
    ifconfig_em0="inet 192.168.1.10 netmask 255.255.255.0"
    ### Default gateway ###
    defaultrouter="192.168.1.10"
    
    but same result once I execute /etc/rc.d/netif restart setting is gone.
     
  5. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,209
    Likes Received:
    15
    It would help to see the rest of /etc/rc.conf. My guess is that you have a DHCP entry after the static IP entries.
     
  6. lavi0007

    lavi0007 New Member

    Messages:
    5
    Likes Received:
    0
    Hi, Please mark this post as solved. The issue is resolved, I restarted the system again it started working...
     
  7. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,392
    Likes Received:
    7
    /etc/rc.d/netif only restarts the interface. In doing so it will remove the default gateway. You need to restart /etc/rc.d/routing too.