Define Static Routes at Boot

I'm running Ubuntu desktop 10.04 and on every boot the machine cannot be accessed from outside the LAN. after running sudo route add default gw 192.168.1.1 everything works as expected. Is there any way to make this happen on boot? I've tried adding a cron job but that didn't work. any ideas?

1 Answer

Add the above command to /etc/rc.local

 route add default gw 192.168.1.1

You need to remove sudo part since /etc/rc.local running as root. Anything added to this file will be executed after all other startup programs.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest