# How to get input settings to rc.conf on the command line



## WATANABE Takeo (Mar 14, 2021)

Please let me know if there is a way (commands, etc.) to reflect the settings entered on the command line as root in rc.conf.


----------



## SirDice (Mar 14, 2021)

sysrc(8)? bsdconfig(8)? I'm not sure what you're asking.


----------



## a6h (Mar 15, 2021)

I think he's looking for running a program at startup (as a root?). It that is so, start with crontab(5), crontab(1) and cron(8)


----------



## zirias@ (Mar 15, 2021)

I think he's looking for some "magic" way to persist any system configuration done manually at the prompt to /etc/rc.conf. Doesn't exist.


----------



## WATANABE Takeo (Mar 15, 2021)

I'm sorry to say it confusingly. Here's what I wanted to know:

In network settings, etc., without writing directly in rc.conf

# ifconfig gi0 create inet6 tunnel xxxx :: yyyy: mtu 1460

You may set it by executing a command like this. However, if nothing is done, the settings will be lost when the PC is restarted. Therefore, I think it is necessary to describe it in rc.conf.

I'm ashamed to say that I don't know how to write it in rc.conf that gives the same instructions as this command. Therefore, I wondered if there was a way to post the command execution status to rc.conf.

If anyone knows, please let me know.


----------



## SirDice (Mar 16, 2021)

WATANABE Takeo said:


> ```
> # ifconfig gi0 create inet6 tunnel xxxx :: yyyy: mtu 1460
> ```



That translates to  

```
create_args_gif0="tunnel <local IPv4> <remote IPv4>"
ifconfig_gif0_ipv6="inet6 <local IPv6> <remote IPv6> prefixlen 64"
```
Change the IP addresses accordingly. 



WATANABE Takeo said:


> I'm ashamed to say that I don't know how to write it in rc.conf that gives the same instructions as this command.


Nothing to be ashamed off, this is a tricky case, I had quite a bit of trouble setting this up myself.


----------



## WATANABE Takeo (Mar 16, 2021)

My internet connection environment is IPv4 over IPv6 IPoE (IP over Ethernet), and the tunnel of gif0 is set up only with IPv6. In this case, how should I write the two lines that you taught me earlier?


----------



## SirDice (Mar 16, 2021)

I'm not exactly sure how to do that either. But looking at the command you posted earlier you can try this:

```
create_args_gif0="tunnel xxxx:: yyyy::"
ifconfig_gif0="up mtu 1460"
```
Not sure if this does what you want though, I've never set up an IPv4 over IPv6 IPoE before.


----------



## Mjölnir (Mar 16, 2021)

Read the RTFM sysrc(8) and then you can do like
`sysrc create_args_gif0="tunnel <local IPv4> <remote IPv4>"`
`sysrc ifconfig_gif0_ipv6="inet6 <local IPv6> <remote IPv6> prefixlen 64"`
You can browse (read) through /etc/defaults/rc.conf to see what settings are available & their default values.


----------



## SirDice (Mar 16, 2021)

Mjölnir said:


> Read the RTFM sysrc(8) and then you can do like
> `sysrc create_args_gif0="tunnel <local IPv4> <remote IPv4>"`
> `sysrc ifconfig_gif0_ipv6="inet6 <local IPv6> <remote IPv6> prefixlen 64"`
> You can browse (read) through /etc/defaults/rc.conf to see what settings are available & their default values.


This isn't the issue though. The OP is asking how to set up the specific IPv4 over IPv6 IPoE configuration he needs and how to translate the ifconfig(8) commands that's known to work to a configuration suitable for rc.conf. The example I gave was for an IPv6 over IPv4 tunnel, which is the wrong kind of tunnel the OP needs.


----------



## Mjölnir (Mar 16, 2021)

FMLU `ifconfig gif0 create inet6 tunnel xxxx :: yyyy: mtu 1460` =
	
	



```
cloned_interfaces="gif0"
ifconfig_gif0_ipv6="inet6 xxxx :: yyyy:  prefixlen 64"
create_args_gif0="tunnel xxxx :: yyyy: mtu 1460"
```
Feel free to file in a bug report regarding the fine manpage of gif(4): `[wishlist] some wizzard please add an EXAMPLES section`


----------



## WATANABE Takeo (Mar 28, 2021)

# ifconfig gif0 create inet6 tunnel xxxx :: yyyy aaaa :: bbbb up
# route add -inet6 default -intareface0 gif0

How can I put these two lines in rc.conf?


----------



## scottro (Mar 28, 2021)

https://taosecurity.blogspot.com/2005/01/ipsec-tunnels-with-freebsd-although.html 

might help, it has some examples, though I don't know if his final purpose is the same as yours.


----------



## SirDice (Mar 28, 2021)

Don't open multiple threads with the same question. Threads merged.


----------



## scottro (Mar 28, 2021)

Heh, I wondered how I'd missed all the earlier posts. Thanks SirDice.


----------



## Deleted member 30996 (Mar 29, 2021)

WATANABE Takeo said:


> You may set it by executing a command like this. However, if nothing is done, the settings will be lost when the PC is restarted. Therefore, I think it is necessary to describe it in rc.conf.


First of all that's the wrong format for entries in /etc/rc.conf. This is right:


```
tcp_drop_synfin="YES"
cupsd_enable="NO"
```



WATANABE Takeo said:


> # ifconfig gif0 create inet6 tunnel xxxx :: yyyy aaaa :: bbbb up
> # route add -inet6 default -intareface0 gif0
> 
> How can I put these two lines in rc.conf?


If I wanted to send those lines from the terminal as entries into /etc/rc.conf I would use:

`# echo 'tcp_drop_synfin="YES"' >> /etc/rc.conf`
`# echo 'cupsd_enable="NO"' >> /etc/rc.conf`


```
ifconfig gif0 create inet6 tunnel xxxx :: yyyy aaaa :: bbbb up
route add -inet6 default -intareface0 gif0
```

That looks more like something I'd put in a pf ruleset.


----------



## SirDice (Mar 29, 2021)

Look at the example I gave in post #8.


----------



## StanTheBear (Dec 30, 2021)

Good point read man about sysrc then things make sense I was setting up unbound to start at a iocage jail for wireguard... SirDice helped thanks


----------

