Score:1

Adding default routes in dhclient-exit-hooks breaks ssh until first sending a ping

au flag

I nave a system running with 2 network cards. To make sure the default route is correct for each card added the following to /etc/dhclient-exit-hooks:

if [[ "$interface" == "eth0" ]]; then
    if [ "$reason"  == "BOUND" ]; then
        ip rule add from "$new_ip_address" table 234
        ip route add default via "$new_dhcp_server_identifier" dev "$interface" table 234
        fi
fi

if [[ "$interface" == "eth1" ]]; then
    if [[ "$reason"  == "BOUND" ]]; then
        ip rule add from "$new_ip_address" table 345
        ip route add default via "$new_dhcp_server_identifier" dev "$interface" table 345
    fi
fi

Now to the issue when i try and ssh into the system is says that there is no route to host. But if i first ping the system and then try and ssh it works. What am I doing wrong here?

Raffa avatar
jp flag
for `dhclient`, you probably need to place your executable script under `/etc/dhcp/dhclient-exit-hooks.d/` and not under `/etc/` ... And the need to ping first to update the external network equipment tables/routes indicates a non-optimal network configuration.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.