Page MenuHomeVyOS Platform

Ability to ignore default-route from dhcpcd per interface
Open, NormalPublicFEATURE REQUEST

Description

Based upon https://phabricator.vyos.net/T173#3019 it should be possible to make a per interface setting configurable. According to http://manpages.ubuntu.com/manpages/trusty/man8/dhclient-script.8.html the variable $interface should contain the interface to match on.

Details

Difficulty level
Easy (less than an hour)

Related Objects

Event Timeline

fatihusta added a comment.EditedDec 12 2016, 9:21 AM

I wrote this hook script
Any available options ignoring this code

Create and edit hook script file

nano /etc/dhcp/dhclient-enter-hooks.d/ignore-options

Copy and Paste this code into ignore-options hook script

confdir="/etc/dhcp/ignore_options"

if [ -f ${confdir}/${interface} ]
then
    case ${reason} in
        BOUND|RENEW|REBIND|REBOOT)
            options=$(cat ${confdir}/${interface} | grep -v "^#")
            for option in ${options}
            do
                eval "var=\$${option}"
                if [ -n "${var}" ]; then
                    unset ${option}
                fi
            done
        ;;
    esac
fi

Create directory

mkdir /etc/dhcp/ignore_options

Create interface file and edit

nano /etc/dhcp/ignore_options/eth0

then add line by line options into interface conf file
for examle.

new_routers
new_static_routes
new_rfc3442_classless_static_routes
new_domain_name
new_domain_name_servers
new_netbios_name_servers
new_ntp_servers

ALL available options

new_alias_ip_address
new_ip_address 
new_host_name 
new_network_number 
new_subnet_mask
new_broadcast_address 
new_routers 
new_static_routes
new_rfc3442_classless_static_routes
new_domain_name 
new_domain_search 
new_domain_name_servers
new_netbios_name_servers 
new_netbios_scope
new_ntp_servers
new_ip6_address 
new_ip6_prefix ip6_prefixlen
new_dhcp6_domain_search 
new_dhcp6_name_servers
syncer edited subscribers, added: VyOS 1.2 Crux; removed: VyOS 1.1.x (1.1.8), syncer.

I'm sorry for the belated response. This is great. Thanks for your contribution @fatihusta! Once testing checks out I'll add this to my CLI integration todo.

pasik added a subscriber: pasik.Oct 1 2018, 9:54 AM
syncer changed the subtype of this task from "Task" to "Feature Request".Oct 19 2018, 9:27 AM