# net.inet.icmp.drop_redirect do not set value1



## elimelech007 (Jan 7, 2022)

In the file /etc/sysctl.conf I registered net.inet.icmp.drop_redirect = 1
But when I check in the terminal with the command:

```
# sysctl net.inet.icmp.drop_redirect
net.inet.icmp.drop_redirect: 0
```


Why 0?


----------



## mer (Jan 7, 2022)

What happens if you do the following command as root?  (su or sudo)

sysctl -w net.inet.icmp.drop_redirect=1

If that works, then did you reboot after changing or do service sysctl restart?


----------



## SirDice (Jan 7, 2022)

Just modifying the /etc/sysctl.conf file doesn't change anything on the running system. You need to apply them too. You can do this with the sysctl(8) command or, if you modified sysctl.conf, `service sysctl restart`.


----------



## elimelech007 (Jan 7, 2022)

after the changes i made:

after the changes i made:

```
# /etc/rc.d/sysctl restart
Need a reboot too?
```

Need a reboot too?


----------



## SirDice (Jan 7, 2022)

In that case, no. Just make sure to restart /etc/rc.d/sysctl as that will apply the settings from /etc/sysctl.conf.


----------



## elimelech007 (Jan 7, 2022)

Rebooted and the parameter returned to 0. why?


----------



## mer (Jan 7, 2022)

You saved the file after making the changes, yes?
The line you added looks like this:
net.inet.icmp.drop_redirect=1

No spaces around the "=" sign?
If you do the following as root, does it get set correctly?

service sysctl restart

If not, then there is a syntax error somewhere in the file.


----------



## covacat (Jan 7, 2022)

its reset by  /etc/rc.d/routing on icmp_drop_redirect from rc.conf


----------



## elimelech007 (Jan 7, 2022)

mer said:


> You saved the file after making the changes, yes?


net.inet.icmp.drop_redirect=1 recorded without errors


----------



## elimelech007 (Jan 7, 2022)

covacat said:


> its reset by  /etc/rc.d/routing on icmp_drop_redirect from rc.conf


in rc.conf I don't have this parameter​


----------



## covacat (Jan 7, 2022)

its set to "auto" in defaults/rc.conf
if auto and no dynamic routing its set to 0

```
_icmp_drop_redirect="${icmp_drop_redirect}"
        case "${_icmp_drop_redirect}" in
        [Aa][Uu][Tt][Oo] | "")
                if _check_dynamicrouting; then
                        _icmp_drop_redirect="yes"
                else
                        _icmp_drop_redirect="no"
                fi
                ;;
        esac
  if checkyesno _icmp_drop_redirect; then
                ropts_init inet
                echo -n ' ignore ICMP redirect=YES'
                ${SYSCTL} net.inet.icmp.drop_redirect=1 > /dev/null
        else
                ${SYSCTL} net.inet.icmp.drop_redirect=0 > /dev/null
        fi
```


----------



## elimelech007 (Jan 7, 2022)

How to make 1?


----------



## covacat (Jan 7, 2022)

icmp_drop_redirect="yes" in rc.conf
also you may remove it from sysctl.conf


----------



## elimelech007 (Jan 7, 2022)

Thanks!


----------



## mer (Jan 7, 2022)

covacat said:


> icmp_drop_redirect="yes" in rc.conf
> also you may remove it from sysctl.conf


Interesting.  I'm guessing that routing is run after sysctl so it gets set to 1 then unset.


----------



## covacat (Jan 7, 2022)

mer said:


> Interesting.  I'm guessing that routing is run after sysctl so it gets set to 1 then unset.


looks like, yes
in fact i found the problem/solution with grep


----------



## Alain De Vos (Jan 7, 2022)

```
sysctl -f /etc/sysctl.conf
```


----------

