# Forgetting network settings on shutdown



## paulehoffman (May 28, 2011)

Greetings again. *shutdown now* to get into single-user mode does not forget the current networking settings such as ifconfigs and routes. So, if you change /etc/rc.conf, *shutdown* to single user mode, then start up again, the changed settings are *added* to the old ones instead of replacing them.

Is there a simple way to make *shutdown now* forget all networking settings or, if not just those, everything? That is, how can I make *shutdown now* followed by *exit* be a faster way to do *reboot*?


----------



## wblock@ (May 29, 2011)

It's not clear what network settings you're changing, or why.  Depending on the requirements, there are fancy automatic solutions like lagg(4) or more brute-force methods like restarting /etc/rc.d/netif or maybe just using ifconfig(8) to delete an IP address.


----------



## willyeahright (Aug 21, 2011)

i'm sure there is a thread out there that has at least touched on this - point me in the right direction should you find me in the wrong thread:

followed the example in the handbook: 24.7 rebuilding world

after following all the steps, recompiling most of my software, i noticed that my internet connection says active, yet ' no dice ' [ ' ' ] on actual connecting to the internet. i thought i would just have to add a line in the rc.conf, or have sysinstall do an edit. first using /etc/netstart looks like the script does the task, [ ' ' ]; ifconfig says the connection is active, though i am still having difficulty connecting to the internet. ( internet is working for girlfriend on the lan is fine )

another point is that if i set the connection via sysinstall, the connection works, adds another, duplicate entry in rc.conf ifconfig_card="dhcp". this used to work. upon reboot, no internet, and of course if i reset the connection via sysinstall... the internet will work, and i will have ' three ' identical lines in my rc.conf. rebooting will just do the same, no internet the report that followed.

then i can only get to the internet via resetting the connection in sysinstall. i'm sure there must be an easier way, or perhaps i deleted or improperly merged something during mergemaster?

thanks in advance

will


----------



## wblock@ (Aug 22, 2011)

After the system has been installed, stop using sysinstall.

What do you mean by "no internet"?  Does ping work?  Or is it DNS?

What network card do you have?


----------



## willyeahright (Aug 22, 2011)

after checking the logs, i think the issue has to do with dhclient. no internet = ping errors with messages of lack of internet connection.

the issue mentioned is unrelated to dns. as i mentioned, running sysinstall ( just setting up a network interface ) restores the connection, and dns happens through a router ( also unrelated to the issue ). i know sysinstall is somehow no; just a quick hack to get on the forums.

i'll run a test by bringing the network down, and starting up dhclient and see if that does the trick. should that work, how would i get that to work during boot? something must have happened during / prior to installworld. there has to be  a something simple answer. ifconfig detects my network card just fine.

' get ' sarcasm os was detected; however, the source of frustration might add in other networking troubles and thus the word in some cases was ported to another category.


----------



## SirDice (Aug 22, 2011)

Set this in /etc/rc.conf:

```
ifconfig_rl0="DHCP"
```

Replace rl0 with _your_ network interface.


----------



## willyeahright (Aug 22, 2011)

*well, i've a non sysinstall solution ...*



			
				sirdice said:
			
		

> set this in /etc/rc.conf:
> 
> ```
> ifconfig_rl0="dhcp"
> ...



hmm, that's alternative to 'working'.

when i type *dhclient rl0* [ interface of the month  ], i get a dhcp lease. so, i've got part of my answer now.

i guess i can postulate [ ' ' ] something went awry with dhclient - post buildworld / buildkernel/installkernel mergemaster -p / installworld / mergemaster; reboot. with that information, any insight? i followed the guide as was written. afaik the only thing that was opposite ( for lack of a better term ) to working is holding onto dhclient settings. i thought i got that handled by reading a manpage and working through the process; perhaps i need a more in depth article.

also, i set 
	
	



```
dhclient="yes"
```
 in the rc.conf - seems that has yet to yield any fruit. have to call dhclient manually to get a lease.

i'll search the internet and see what i can find on the issue in discussion. if you think of something before i do, please... i'm totally stoked you answered so quickly. 51% of the issue still remains.


----------



## SirDice (Aug 22, 2011)

You can also try:

```
ifconfig_rl0="SYNCDHCP"
```

Are you sure you have an rl0? Post the output of `# ifconfig -a`


----------



## willyeahright (Aug 24, 2011)

*a solution, good advice from sir dice and wblock, plus head scratching*

no, i am lacking rl0 in favor of...

the issue brought up is a bummer i will be unable to test out the ifconfig_"alternative rl0"="syncdhcp" i rolled back because my system had ceased to be or has yet been working proper with a few things like vitrualbox. i suspect i corrupted something. i applied what i learned when i started from scratch.

yes, i did a fresh install; however, that is for unrelated issues.

i was in the process of a backup, as i was using 3*3 current and was sure at some point something like this would happen. as i am studying freebsd, i was trying to learn how to have done a proper makebuildworld / installworld - each step a postulate. [ ' ' ]

this time i will most definately keep a spreadsheet / calcsheet to log my steps, and use the forums and do a test run before actually commiting to changes

prior to the newfs:

since i could attract a running online experience w/ sysinstall [ ' ' ], ifconfig -a would easily give myself that information. as i said before, a network card was detected and the issue had something to have done with dhclient.

// the solution was ... background_dhclient="yes" in the rc.conf.

oddly, the first attempt to enable dhclient was unsuccessful and there is suspicion the incident had to have done with the order in which the client was called. i have no proof for this though. this was unnecessary before attempting kernel and ' build/install/world ' changes.

there was also mention that once into the shell, typing sudo dhclient yielded a valid dhcp lease. in order to obtain a valid dhcp lease, there is a state safe to forecast the network card was correctly detected. again, adding // background_dhclient="yes" in the rc.conf worked and the result was ' a connection to the internet. one could ping, and browse ', post reboot.

this step seemed un'necessary prior to running a buildworld /  makeworld which attracts suspicion of doing something wrong with mergemaster, or failing to correctly restore /etc. a reference says right in the freebsd handbook to back up /etc prior to rebuilding the ' world ', and there is thought to take that advice next time. after reading the handbook again, a brush up on what mergemaster does the likely reaction.

also, part of the matter seems lacking of clarity conveying the issue.  an attempt to explain the ' issue ' again, because the ' issue ' still makes less sense, even though the issue is solved. 

perhaps if understanding the network startup phase better is a process, what happened during makebuild/installworld or most likely mergemaster would be understood. [ ' ' ]

will


----------



## willyeahright (Aug 24, 2011)

*proper threading*

thanks for editing the post with [cmd=""]correct format conventions[/cmd] dutchdaemon, i will do an implemention in the future.


----------



## willyeahright (Aug 24, 2011)

*nfe0*

no, i have and alternative to rl0.

the connection dilemm()a mentioned is a bummer:

i am non able, // ' '; to test out the *ifconfig_"non rl0"="syncdhcp"*

i rolled back because my system failed to be working proper with a few things like vitrualbox. i suspect i corrupted something. i applied what i learned while i started from scratch.

yes, i did a fresh install; however, that is for non' related issues.

i was in the process of a backup, as i was using 3*3 current and was sure at some point something like this would happen. as i am studying freebsd, i was trying to learn how to do a proper *make buildworld / or make installworld* - each step a quote ' postulate ' unquote. [ ' ' ]

this time around i will most definately keep a spreadsheet to log my steps, and use the forums and do a test run prior of actually commiting to changes

preceeding the `# newfs`:

since i could set a running internet w/ *sysinstall*, *ifconfig -a*, the result' would [ ' ' ] easily give me that information. as typed before, ' the card ' was detected and the issue had something to have done with dhclient.

// the solution was ... *background_dhclient="yes"* in the *rc.conf*. ( according to a source );

oddly, my first attempt to enable *dhclient* was unsuccessful and i suspect the issue had to have done with the order in which the process or client was called. i have no proof for this though. this was an unneeded prior to ' i did the kernel and ' build/install/world ' changes '.

i also mentioned that once i type' to the shell, typing *# sudo dhclient*, yielded a valid dhcp lease. in order to obtain a valid dhcp lease, there is a safe conclusion to attribute a value such as ' the network card was ' ' ', was correctly detected. again, adding // *background_dhclient="yes"* in the *rc.conf* worked and i was ' connected to the internet, could ping, and browse ', post reboot.

this step was unnecessary prior to running a *buildworld / makeworld* which makes me suspect ' questionable accuracy ' with *mergemaster*, or failed to correctly restore /etc. stated right in the freebsd handbook texts, is the instruction to back up /etc prior to rebuilding the ' world '. i think i'll take that advice next time // ' and ';. after reading the handbook again, i will brush up on what *mergemaster* does.

also, there seems to be a sense of difficult conveying my issue. i attempted explanation of the issue mentioned earlier again, because the error or problem described still fails to make sense to myself, even though the issue is ' already ' solved. perhaps if i understood the network startup phase better, i'd understand what happened during *makebuild/installworld* or most likely *mergemaster*.

will

my comment on the ' moderating ' was meant as ' oops i forgot ', forgive me. that link was very useful. thank you dutchdaemon, wblock, and sir dice. // ' '; i attempted to tell you how many times your posts have been useful. [ ' ' ];


----------

